-->
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.  [ 1 post ] 
Author Message
 Post subject: I need help converting this sql
PostPosted: Fri Nov 12, 2004 4:26 pm 
Newbie

Joined: Tue Oct 19, 2004 3:22 pm
Posts: 6
Location: Mobile, RV
I need help converting this SQL (which works):

select c.last_name, c.first_name, np.first_name FullFirst
from dggs_project.contact c left join dggs_project.contact np on np.preferred_name_id = c.contact_id
where c.preferred_name_id is null
order by c.last_name
;

to HQL.

Contact is the hibernate object.

I tried this:

select c, npc from Contact c, Contact npc
where npc.contact = c

but that runs out of memory. the npc alias refers to the "child". preferred_name_id gets mapped to "contact", an instance of Contact inside Contact.

preferred_name_id is null for the parent. I don;t like reflexive joins but I have to deal with this legacy database!


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

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.