-->
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: Multi Table Query into single Pojo via Mapping?
PostPosted: Tue Nov 24, 2009 12:16 pm 
Newbie

Joined: Tue Sep 15, 2009 3:36 am
Posts: 7
Location: London
Good Afternoon,

I am a newbie and have no doubt this questions is so stunningly stupid it will cause me embarrassment when I cast my eyes over it in future years!

Anyway...

Our database is mapped and working lovely. I would now like to run queries that return fields from multiple tables in a single aggregated POJO. This is fine and I can follow the examples from the Hibernate tutorial and return the results as arrays of Objects, a List (or even pass results directly to a Constructor) and manually create\build up the POJO.

Is there a cleverer way to do this with hibernate mapping files? This would just be for query results (reads), not for persisting.

Cheers

Mat


Top
 Profile  
 
 Post subject: Re: Multi Table Query into single Pojo via Mapping?
PostPosted: Tue Nov 24, 2009 12:28 pm 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Well, your constructor solution is the way to go. Another way to solve it would be creating a view and map your class to that view.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject: Re: Multi Table Query into single Pojo via Mapping?
PostPosted: Wed Nov 25, 2009 6:27 am 
Newbie

Joined: Tue Sep 15, 2009 3:36 am
Posts: 7
Location: London
Thanks for the confirmation.

Cheers

Mat


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.