-->
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: Mapping same class to many tables
PostPosted: Mon Aug 22, 2005 10:45 am 
Newbie

Joined: Mon Aug 22, 2005 10:39 am
Posts: 7
Hi all,

My application uses the same class in two different contexts and needs to be persisted in different tables depending on the context. Here is a more precise idea:

public class CommonObject {
// ...
}

public class Context1 {
private List<CommonObject> commons = new LinkedList<CommonObject>();
// ...
}

public class Context2 {
private List<CommonObject> commons = new LinkedList<CommonObject>();
// ...
}

If saving an object of class Context1, I want its CommonObject instances to be saved in table 1; if saving an object of class Context2, I want its CommonObject instances to be saved in table 2. An instance of CommonObject is never shared between objects of Context1 and Context2.

How can I go on about doing this?

Thanks a lot,
GB


Top
 Profile  
 
 Post subject: Re: Mapping same class to many tables
PostPosted: Mon Aug 22, 2005 11:23 am 
Regular
Regular

Joined: Thu Dec 02, 2004 7:11 am
Posts: 85
gbilodeau wrote:
How can I go on about doing this?


You can use 'composite-element'


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 11:33 am 
Newbie

Joined: Tue Aug 02, 2005 1:40 pm
Posts: 16
Location: US
I belive using <any > mapping would solve your problem. Try to go thru this

http://www.hibernate.org/122.html


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.