-->
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: how to generate multiple class instances from one row
PostPosted: Wed Jun 08, 2005 3:27 pm 
Newbie

Joined: Wed Jun 08, 2005 3:12 pm
Posts: 6
I have two classes, Project and ProjectStep, with corresponding tables in a basic one record->one instance setup. For performance reasons (simplifying a bit here), the two are pulled into a view we'll call ProjectCurrentStep. What I want to do is create a mapping that will generate a Project and a ProjectStep for each row returned from this view. It seems like this should be a relatively common occurrence, but I'm having a difficult time finding info on the best way to go about doing this.

What I'm thinking so far is that I'll need an intermediate class, ProjectCurrentStep, which will have as attributes a Project and a ProjectStep instance. I believe I can do this by declaring the Project and ProjectStep attributes as components, but this would duplicate their hibernate mappings. Is there a way to import mappings?

The other option I'm considering is thinking of the ProjectCurrentStep class as a facade, delegating calls to its getters and setters to the contained Project and ProjectStep instances.

Thanx ahead for any help...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 08, 2005 3:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
component


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 1:18 pm 
Newbie

Joined: Wed Jun 08, 2005 3:12 pm
Posts: 6
So if I use a composite element to create an instance of a persistence class defined in another mapping, does that cause any issues with persisting changes to that instance?


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.