[hibernate-issues] [Hibernate-JIRA] Created: (JPA-1) many-to-one id="true" is not picked up by hibernate in orm.xml

Rolf Thunbo (JIRA) noreply at atlassian.com
Thu Jul 15 04:56:13 EDT 2010


many-to-one id="true" is not picked up by hibernate in orm.xml 
---------------------------------------------------------------

                 Key: JPA-1
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-1
             Project: Java Persistence API
          Issue Type: Bug
            Reporter: Rolf Thunbo


When making a composite key referring to a target entity something like the following ORM XML should be defined:

<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"
    version="2.0">
    <entity class="Subscription">
        <table name="SUBSCRIPTION"/>
        <id-class class="SubscriptionKey"/>
        <attributes>
            ...
            <many-to-one name="owner" id="true">
                <join-column name="FK_SUBSCRIBER_CVR"/>
            </many-to-one>
        </attributes>
    </entity>
</entity-mappings>

But for some reason the id attribute is not picked up by Hibernate, and therefore it does not interpret the relation as a primary key. A workaround is to add a id tag referring to the same property, but it would be nice of Hibernate would pick up the id attribute on the many-to-one relation.

-- 
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