26 lines
738 B
Java
26 lines
738 B
Java
package eu.eudat.configurations.typedefinition;
|
|
|
|
import org.hibernate.HibernateException;
|
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.SQLException;
|
|
import java.sql.Types;
|
|
|
|
public class PostgreSQLEnumType extends org.hibernate.type.EnumType {
|
|
|
|
public void nullSafeSet(
|
|
PreparedStatement st,
|
|
Object value,
|
|
int index,
|
|
SharedSessionContractImplementor session)
|
|
throws HibernateException, SQLException {
|
|
st.setObject(
|
|
index,
|
|
value != null ?
|
|
((Enum) value).name() :
|
|
null,
|
|
Types.OTHER
|
|
);
|
|
}
|
|
} |