-->
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: SELECT query with JOIN.
PostPosted: Tue May 25, 2004 10:50 am 
Regular
Regular

Joined: Tue May 11, 2004 9:23 am
Posts: 69
Hey,

I got a SELECT query and I want to perform a join between two tables. The thing is that in table CountryT I have a primary key (countrycode) and in the other table (StoreT) I have primary key storeno with countrycode as a foreign key.

So, I first performed this query:

Code:
Query q = session.createQuery("SELECT st.storeno, st.storename, co.countrycode FROM net.sf.hibernate.CountryT co, net.sf.hibernate.StoreT st WHERE co.id=st.id AND co.id='DK'");


Now this doesn't work since Hibernate then compares countrycode with storeno.

So how do I write a query that compare the the primary key with the foreign key? (that is like....countrycode=countrycode)


Br. Newman


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2004 11:01 am 
Regular
Regular

Joined: Tue May 11, 2004 9:23 am
Posts: 69
Ladies & Gentlemen, a solved it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 01, 2004 10:18 am 
Newbie

Joined: Wed Apr 21, 2004 5:06 am
Posts: 7
Location: India
can you please post it, how you have solved it


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.