View Javadoc
1   package myorg.relex.collection;
2   
3   import javax.persistence.*;
4   
5   /**
6    * This class is provides an example of an entity that implements hashCode/equals 
7    * using the default java.lang.Object implementation. Note this implementation is instance-specific. 
8    * No other instance will report the same value even if they represent the same row in the DB.
9    */
10  @Entity
11  @Table(name="RELATIONEX_SHIP")
12  public class ShipByDefault extends Ship {
13  	@Override
14  	public int peekHashCode() {
15  		return super.objectHashCode();
16  	}
17  
18  	@Override
19  	public boolean equals(Object obj) {
20  		try {
21              if (this == obj) { return logEquals(obj, true); }
22  			boolean equals = super.equals(obj);
23  			return logEquals(obj, equals);
24  		} catch (Exception ex) {
25  			return logEquals(obj, false);
26  		}
27  	}
28  }