In addition to the problem indicated in
http://forum.hibernate.org/viewtopic.php?t=930056 (for which I currently have no solution), I have another issue regarding hbm2java.
My problem is I have a number of classes that get created and manipulated before being persisted: some of those manipulations involve putting them in sets, but here is the problem.
The default hashcode implementation provided by hbm2java uses jakarta commons lang HashcodeBuilder and EqualsBuilder, and here's the problem: if nothing else has been specified, the builders use the id property to calculate hashcode and equality.
The problem is that when those classes have just been created, they have no id, as it will be generated when persisting them: hashcodebuilder and equalsbuilder both return the same value for this case.
My question is: shouldn't the default implementation resort to Object.hashcode and Object.equals when the fields submitted to the builders are all null?