diff --git a/dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateEntity.java b/dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateEntity.java index 0fd87a705..5f06d674b 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateEntity.java +++ b/dmp-backend/core/src/main/java/eu/eudat/data/DescriptionTemplateEntity.java @@ -7,7 +7,9 @@ import eu.eudat.data.converters.enums.DescriptionTemplateStatusConverter; import eu.eudat.data.converters.enums.DescriptionTemplateVersionStatusConverter; import eu.eudat.data.converters.enums.IsActiveConverter; import eu.eudat.data.old.queryableentity.DataEntity; +import eu.eudat.data.types.SQLXMLType; import jakarta.persistence.*; +import org.hibernate.annotations.Type; import java.time.Instant; import java.util.List; @@ -26,7 +28,8 @@ public class DescriptionTemplateEntity implements DataEntity { + + private final int[] sqlTypesSupported = new int[] { Types.VARCHAR }; + + @Override + public int getSqlType() { + return Types.VARCHAR; + } + + @Override + public Class returnedClass() { + return String.class; + } + + @Override + public boolean equals(String x, String y) throws HibernateException { + if (x == null) { + return y == null; + } else { + return x.equals(y); + } + } + + @Override + public int hashCode(String x) throws HibernateException { + return x == null ? null : x.hashCode(); + } + + @Override + public String nullSafeGet(ResultSet rs, int i, SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws SQLException { + String xmldoc = rs.getString( i ); + return rs.wasNull() ? null : xmldoc; + } + + @Override + public void nullSafeSet(PreparedStatement st, String value, int index, SharedSessionContractImplementor sharedSessionContractImplementor) throws SQLException { + if (value == null) { + st.setNull(index, Types.OTHER); + } else { + st.setObject(index, value, Types.OTHER); + } + } + + @Override + public String deepCopy(String value) throws HibernateException { + if (value == null) + return null; + return new String( (String)value ); + } + + @Override + public boolean isMutable() { + return false; + } + + @Override + public Serializable disassemble(String value) throws HibernateException { + return (String) value; + } + + @Override + public String assemble(Serializable cached, Object owner) throws HibernateException { + return (String) cached; + } + + @Override + public String replace(String original, String target, Object owner) throws HibernateException { + return original; + } +} \ No newline at end of file