/* (non-Javadoc) * @see org.hibernate.usertype.CompositeUserType#nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int, org.hibernate.engine.SessionImplementor) */ @Override public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws HibernateException, SQLException { final CtxAssociationIdentifier id = (CtxAssociationIdentifier) value; Hibernate.STRING.nullSafeSet(st, id.getOwnerId(), index); Hibernate.STRING.nullSafeSet(st, id.getType(), index + 1); Hibernate.LONG.nullSafeSet(st, id.getObjectNumber(), index + 2); }
/* * @see org.hibernate.usertype.CompositeUserType#nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.SessionImplementor, java.lang.Object) */ @Override public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { final String ownerId = (String) Hibernate.STRING.nullSafeGet(rs, names[0]); final String type = (String) Hibernate.STRING.nullSafeGet(rs, names[1]); final Long objectNumber = (Long) Hibernate.LONG.nullSafeGet(rs, names[2]); if (ownerId == null || type == null || objectNumber == null) return null; return new CtxAssociationIdentifier(ownerId, type, objectNumber); }