-->
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: mapping multiple table query results into list of POJOs
PostPosted: Wed Mar 09, 2011 8:20 am 
Newbie

Joined: Wed Mar 09, 2011 6:13 am
Posts: 2
Hello all,

first off, I am new to Hibernate and very unexperienced, this question might be really simple to answer or even in the documentation, if so, please point me there, as I tried searching it and didn't find something adequate. (Maybe I searched for the wrong terms?)

I have the following problem:


I have a Database which was constructed with ORM in mind, so table mappings have been no problem.
Now however, I want to fetch results of a query and put those results into a List of POJO's (variables are the columns) which have no need to be persistent.
I had the idea to use a view and map that onto an Object, but I'm using MySQL and the performance with views is just way too bad.
Another thing is, those POJO's would be very similar in a lot of columns, is there any possibility to 'pack' entries together?

I'll give you an example of what I mean:

Quote:
if i have a table job-offering(JobOffID, Company, ..),
a table Job(JobID, jobofferingID(references JobOffID), actid(FK from activity table), ..)
a table activity(ActID, name, ..)


I want to join those tables on the appropriate values with a query selecting a subset of all columns and then have the result given back to me as a list of POJOs with those variables.

If someone could give me a hint how to do that, I'd be thankful.

An additional question (but of lesser importance):

A lot of my results will only differ in the activity.name column (i.e. a painter will have activities 'paint' and 'mix colours')
Is there any convenient way to get those results into 1 POJO with the activity.name entries added to a list in that pojo?

If my question isn't clear enough please ask, I'll try to make it as clear as possible then.

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.