My HQL for a outer join fails:
"select p.postalCode from Person p outer join p.Address a"
The exception is:
org.hibernate.QueryException: could not resolve property: Address of: com.Person AS p left join p.Addresss AS a
The join is for the primary keys in each table contact_id
My ORM.xml looks like this:
Code:
<entity class="com.Person"
name="Person">
<table name="person"/>
<primary-key-join-column name="contact_id" referenced-column-name="contact_id" />
<attributes>
<basic name="personId">
<column name="person_id" column-definition="number(38)" nullable="false" />
</basic>
<one-to-one name="address" target-entity="com.Address">
<join-table name="address">
<join-column name="contact_id"/>
<inverse-join-column name="contact_id"/>
</join-table>
<cascade>
<cascade-persist/>
<cascade-merge/>
<cascade-refresh/>
</cascade>
</one-to-one>
</attributes>
</entity>
Code:
<entity class="com.Address" name="Address" >
<table name="address"/>
<inheritance strategy="JOINED"/>
<sequence-generator name="SEQ" sequence-name="SQ_contact_info" allocation-size="1"/>
<attribute-override name="id">
<column name="contact_id" />
</attribute-override>
<attributes>
<basic name="city">
<column name="city_enc" column-definition="RAW(192)" nullable="true" />
</basic>
<basic name="postalCode">
<column name="postal_code_enc" column-definition="RAW(64)" nullable="true" />
</basic>
<one-to-one name="person" target-entity="com.Person" mapped-by="address">
<cascade>
<cascade-all/>
</cascade>
</one-to-one>
</attributes>
</entity>
I'm assuming the issue is in the ORM.xml file. Does anyone see the issue.
Thanks