/* * @see org.hibernate.usertype.CompositeUserType#getPropertyValue(java.lang.Object, int) */ @Override public Object getPropertyValue(Object component, int property) throws HibernateException { final Object result; final CtxAssociationIdentifier id = (CtxAssociationIdentifier) component; switch (property) { case 0: result = id.getOwnerId(); break; case 1: result = id.getType(); break; case 2: result = id.getObjectNumber(); break; default: throw new IllegalArgumentException("Unknown property: " + property); } return result; }
/* (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); }