Hibernate version: 2.1.7c
This is my UserType class file.
Code:
public class MoneyType implements UserType {
private static final int[] SQL_TYPES = new int[]{Types.DECIMAL};
public int[] sqlTypes() {
return SQL_TYPES;
}
public Class returnedClass() {
return Money.class;
}
public boolean equals(Object o, Object o1) throws HibernateException {
return o.equals(o1);
}
public Object nullSafeGet(ResultSet resultSet, String[] strings, Object o) throws HibernateException, SQLException {
Money money = new Money();
money.setAmount((BigDecimal) Hibernate.BIG_DECIMAL.nullSafeGet(resultSet, strings[0]));
return money;
}
public void nullSafeSet(PreparedStatement preparedStatement, Object o, int i) throws HibernateException, SQLException {
Hibernate.BIG_DECIMAL.nullSafeSet(preparedStatement, ((Money)o).getAmount(), i);
}
public Object deepCopy(Object o) throws HibernateException {
Money m = new Money();
m = (Money) ((Money) o).clone();
return m;
}
public boolean isMutable() {
return false;
}
}
Why "owner the containing entity" in nullSafeGet method is always setted to null ?
Is it my mistake ?