[hibernate-dev] JPA XML ORM descriptors id-class and id

andrea boriero andrea at hibernate.org
Wed May 9 06:09:51 EDT 2018


For the IdClass annotation the spec states that the "The Id annotation must
also be applied to the corresponding fields or properties of the entity.".
So in my opinion the XML ORM should follow the same rule.

On 8 May 2018 at 23:13, Gail Badner <gbadner at redhat.com> wrote:

> When an entity with an IdClass is mapped using XML ORM descriptors,
> Hibernate requires the Id properties to be mapped as well, as in the
> following example:
>
> <entity class="Employee">
>
>    <table name="entityobject"/>
>    <id-class class="EmployeeId"/>
>    <attributes>
>       <id name="fname"/>
>       <id name="lname"/>
>    </attributes>
> </entity>
>
> If the <id> elements are not included, an exception is thrown:
>
> "No identifier specified for entity: ..."
>
> Should Hibernate require the <id> elements to be explicitly mapped, or
> should it be able to determine this information by reflection from the
> class configured by <id-class>?
>
> Regards,
> Gail
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list