The EclipseLink user guide states that when constructing an IdClass (not embedded) for a composite primary key, it must have a public no-argument constructor and implement the methods equals
and hashCode
. In addition, the example it gives also implements getters and setters.
The Persistence WikiBook has a public constructor with arguments, no no-argument constructor, no getters and setters, and explicitly states that EclipseLink does not require implementation of equals
and hashCode
.
Which of these is really required? Can I use a minimal IdClass with just the attributes and no constructors and no methods, because EclipseLink will generate these for me? Is this dependent on the version of EclipseLink?