[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4861) The primary key type of a derived identity is not correct

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu Jan 28 04:25:30 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35391#action_35391 ] 

Emmanuel Bernard commented on HHH-4861:
---------------------------------------

I think you have a point, Person should really be the type.

That being said, the derived identity takes a different approach in which the java type of the associated entity is considered the or part of the pk

section 2.4.1.1 sums it up. Here is an extract for "simple pks".

If the dependent entity has a single primary key attribute (i.e, the relationship attribute or an attribute that corresponds to the relationship attribute) and the primary key of the parent entity is a simple pri- mary key, the primary key of the dependent entity is a simple primary key of the same type as that of the parententity(andneitherEmbeddedIdnorIdClassisspecified). Inthiscase,either(1)therela- tionship attribute is annotated Id, or (2) a separate Id attribute is specified and the relationship attribute is annotated MapsId (and the value element of the MapsId annotation is not specified).

> The primary key type of a derived identity is not correct
> ---------------------------------------------------------
>
>                 Key: HHH-4861
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4861
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>    Affects Versions: 3.5.0-Beta-3
>            Reporter: Emmanuel Bernard
>
> In org.hibernate.test.annotations.derivedidentities.e4.a
> The main entity (Person) has an id of type String
> The derived entity (MedicalHistory) has an id of type 
> {code}@Id @OneToOne @JoinColumn Person{code}
> The TCK expects to be able to do
> em.find(MedicalHistory.class, "ssn");
> but we do map MedicalHistory id as a core-stype embedded id so the PK is MedicalHistory

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list