Fix type definition issues

This commit is contained in:
George Kalampokis 2023-10-05 15:23:48 +03:00
parent 3d612812b0
commit 05a724d757
3 changed files with 14 additions and 2 deletions

View File

@ -7,6 +7,11 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
/**
* @deprecated hibernate's abstract class is depricated and those type of conversions and checks
* are done by hibernate itself
*/
@Deprecated
public class PostgreSQLEnumType extends org.hibernate.type.EnumType {
public void nullSafeSet(

View File

@ -42,7 +42,12 @@ public class UUIDType implements UserType<UUID> {
@Override
public UUID nullSafeGet(ResultSet rs, int position, SharedSessionContractImplementor session, Object owner) throws SQLException {
return null;
assert (position >= 0);
Object value = rs.getObject(position);
if (value == null) return null;
UUID uuid = UUID.fromString(rs.getString(position));
return rs.wasNull() ? null : uuid;
}
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {

View File

@ -44,7 +44,9 @@ public class XMLType implements UserType<String> {
@Override
public String nullSafeGet(ResultSet resultSet, int i, SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws SQLException {
return null;
assert (i >= 0);
String xmldoc = resultSet.getString(i);
return resultSet.wasNull() ? null : xmldoc;
}
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {