-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL with related object
PostPosted: Tue Jun 13, 2006 4:01 am 
Newbie

Joined: Tue Apr 11, 2006 4:57 am
Posts: 17
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1.3

I have a database table called person, and another called name (so the Data Objects have similar structure). In the person dataobject there is a name dataobject.
The name contains name and nickname.
How can I retrive person if I only know the nickname (with HQL) ?

(somethin' like "from Person as person where person.name.nickname = ?) ???


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 13, 2006 4:09 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
You can use this
Code:
from
   Person as person
   inner join person.name as name
where
   name.nickname = :nickname

or this
Code:
from
   Person as person
   inner join person.name as name
      with
         name.nickname = :nickname


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.