-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: HQL for a outer join fails
PostPosted: Tue May 19, 2009 8:04 am 
Newbie

Joined: Mon May 18, 2009 6:00 pm
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: HQL for a outer join fails
PostPosted: Tue May 19, 2009 8:20 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
It should be "select p.postalCode from Person p outer join p.address a"

The 'a' of 'address' should be lower case. The property names are case sensitive for HQL.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject: Re: HQL for a outer join fails
PostPosted: Tue May 19, 2009 8:34 am 
Newbie

Joined: Mon May 18, 2009 6:00 pm
Posts: 3
Thanks Litty. That solved the issue.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.