[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5176) property-ref doesn't work when property is inside join tags of destination mapping

Stephen Visser (JIRA) noreply at atlassian.com
Thu Apr 29 11:24:28 EDT 2010


property-ref doesn't work when property is inside join tags of destination mapping
----------------------------------------------------------------------------------

                 Key: HHH-5176
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5176
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.0-Final
         Environment: mapping
            Reporter: Stephen Visser


My legacy system requires that I have a join in the mappings to fully specify.

Here is the mapping of the entity.

{quote}
<hibernate-mapping>         
    <class name="Student" table="PERSONS" lazy="false">
        <id name="personID" column="PERSON_ID"/>
        <property name="lastName" column="LEGAL_SURNAME" />
        <property name="firstName" column="LEGAL_FIRST_NAME" />
        <property name="birthDate" column="DATE_OF_BIRTH" />
        
        <join table="STUDENTS">
            <key column="PERSON_ID"/>
            <property name="studentID" column="STUDENT_ID" unique="true" />
        </join>   
    </class>
</hibernate-mapping>
{quote}

However, when I reference the entity in another mapping:

{code}
<hibernate-mapping>
    <class name="Enrolment" table="COURSE_ENROLLMENTS" lazy="false">
        <id name="enrolmentID" column="course_enrollment_id" />
        <many-to-one name="student" column="student_id" class="Student" lazy="false"  property-ref="studentID"/>
    </class>
</hibernate-mapping>
{code}

The studentID property in the Student mapping is assumed to be in the PERSONS table (when in fact it is in the STUDENTS table since it's inside the join tags).  This results in the alias of the PERSONS table being prepended to the STUDENT_ID column.

When using the property-ref attribute, it should be determined if the referenced property is inside any join tags.  If it is, the correct table alias should be inferred.


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