class PGEnumUserType implements EnhancedUserType, ParameterizedType {

	@Override
	public void nullSafeSet(final PreparedStatement st, final Object value,
			final int index, final SessionImplementor session)
			throws HibernateException, SQLException {
		if (value == null) {
			st.setNull(index, Types.VARCHAR);
			// UPDATE: To support NULL insertion, change to: st.setNull(index, 1111);
		} else {
			// Notice 1111 which java.sql.Type for Postgres Enum
			st.setObject(index, (value), 1111);
		}
	}

}