-->
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: Newbie : Query on multiple tables / inner join
PostPosted: Tue Feb 13, 2007 12:15 pm 
Newbie

Joined: Wed Jan 10, 2007 5:20 pm
Posts: 8
Hi, I have a simple but important issue.
I have set up a small hibernate project (with a big database) and I just want to do a query on 2 tables of my db, like this :
select customer.customer_id, customer.customer_name, car.model, car.year where customer.purchase_id=car.purchase_id

I had already made a mapping of [i]customer[/i] before.
My questions are :
1 - I would like to know if I MUST do a mapping of [i]car[/i] to perform this query. Or do I just MUST change my [i]customer[/i] mapping (with a Join for example). Or do both ?
It seems that it is strange if I have to change my [i]customer[/i] mapping, Because I will have many different queries like this with other tables, so if it is the only solution someone will have to explain how this mapping change can be done in a flexible way.

2- Do I have to create a particular Java object to handle the result of this query (this would be very ugly to do...)

Please please, give me the best solution you see for this simple but very important problem.

thanks


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.