-->
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: query question...
PostPosted: Thu Dec 15, 2005 1:42 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
I have a employee class that is a child of person where person has a collection of periodAddress

Code:
     * @hibernate.bag
     *      table="periodAddress"
     *      lazy="true"
     *      cascade="all-delete-orphan"
     *      order-by="start"
     * @hibernate.collection-one-to-many
     *      class="com.ccg.domain.PeriodAddress"
     * @hibernate.collection-key
     *      column="personId


PeriodAddress then has a TEALookup object

Code:
     * @hibernate.property
     *      class="com.ccg.domain.TEALookup"
     *      not-null="false"
     *      column="teaLookupId"


The TEALookup object has two properties an Integer and a Date
Code:
    * @hibernate.property
    * @hibernate.property

When I try to run this query

Code:
SELECT e.id FROM com.ccg.domain.Employee e LEFT JOIN e.periodAddresses.teaLookup t WHERE e.client.id =:clientId AND t.tEAResult =:maybeInt


I get the following exception

org.springframework.orm.hibernate.HibernateQueryException: expecting 'elements' or 'indices' after: teaLookup [SELECT e.id FROM com.ccg.domain.Employee e LEFT JOIN e.periodAddresses.teaLookup t WHERE e.client.id =:clientId AND t.tEAResult =:maybeInt];

Any help would greatly appreciated. Thanks.


Top
 Profile  
 
 Post subject: try this
PostPosted: Thu Dec 15, 2005 2:09 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I think this will work:
SELECT e.id
FROM com.ccg.domain.Employee e
LEFT JOIN e.periodAddresses addr
WHERE e.client.id =:clientId AND addr.teaLookup.tEAResult =:maybeInt

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 2:15 pm 
Regular
Regular

Joined: Mon Aug 22, 2005 1:11 pm
Posts: 50
Location: Pasadena, CA
Thank you for the help but I tried that now I get a diffrent exception:

HibernateQueryException: dereferenced: periodaddr1_.teaLookup.tEAResult [SELECT e.id FROM com.ccg.domain.Employee e LEFT JOIN e.periodAddresses pa WHERE e.client.id =:clientId AND pa.teaLookup.tEAResult =:maybeInt];

Any other thoughts?


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.