AbstractType.java is calling this when x is null...
Code:
public int getHashCode(Object x, EntityMode entityMode) {
return x.hashCode();
}
In this method in EntityType.java
Code:
public int getHashCode(Object x, EntityMode entityMode, SessionFactoryImplementor factory) {
EntityPersister persister = factory.getEntityPersister(associatedEntityName);
if ( !persister.canExtractIdOutOfEntity() ) {
return super.getHashCode(x, entityMode);
}
final Serializable id;
if (x instanceof HibernateProxy) {
id = ( (HibernateProxy) x ).getHibernateLazyInitializer().getIdentifier();
}
else {
id = persister.getIdentifier(x, entityMode);
}
return persister.getIdentifierType().getHashCode(id, entityMode, factory);
}
id is null for that last return call. It calls getIdentifier(x, entityMode) on the persister, which Looks up the POJO tupleizer, and calls abstractEntityTupilizer.getIdentifier(entity) which was then calling into my Entity to get it's id. In this case it was null (because it was newly created).
Now, Im not really sure why it is asking my class for an id. It is annotated as such:
Code:
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Table(name = "products")
@SequenceGenerator(name = "products_seq", sequenceName = "products_seq")
public class Product {
/* ... */
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "products_seq")
@Column(name="product_id")
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
/* ... */
}
There is a ManyToOne for a productMaster which has two back references to it: the original product and and a list of the current products. I'll be looking into why it is asking that class for an id today... any advice would be appreciated.