[jpa-spec users] Specification improvements for compound ids

From: Oliver Gierke <>
Date: Mon, 9 Jan 2012 08:13:37 -0800

Hi all,

when working with compound ids in entities, esp. when using @IdClass various JPA implementations behave quite differently which makes a consistent usage very hard. Here are some of the issues I've identified.

1) the JavaDoc of IdentifiableType.getIdType() seems to a bit vague in terms of what clients can expect when calling this method. Thus, various implementations handle that case differently. Hibernate does not return the type defined in an @IdClass annotation [0], whereas OpenJPA and EclipseLink return the annotated type correctly.

2) Generation of partial id values does not work with EclipseLink and Hibernate. EclipseLink rejects the class while building the meta model already saying only one id attribute can be auto-generated. Hibernate seems to have trouble assigning values to the attributes in question [1].

The discussion on whether these are critical bugs aside, I'd argue that the spec could be a bit more precise (especially for 1) or leave a few ore words on to what degree one can rely on auto-generation of id values for compound identifiers.



 * @author Oliver Gierke - Senior Member Technical Staff
 * @param email
 * @param phone +49-351-30929001
 * @param fax   +49-351-418898439
 * @param skype einsdreizehn
 * @see