Using hbm2Java the equals()-Method of the ID is created as follows:
Code:
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof IrbaccfId) ) return false;
SampleId castOther = (SampleId) other;
return (this.getKey()==castOther.getKey())
&& (this.getDate()==castOther.getDate()) ||
(this.getDate()!=null &&
castOther.getDate()!=null &&
this.getDate().equals(castOther.getDate()) );
}
(the method getKey() returns an int.)
Because of missing brackets, equals() returns true if only the Date is equal, as the right part of the disjunction is true.