-->
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.  [ 4 posts ] 
Author Message
 Post subject: Is this possible?
PostPosted: Mon Apr 05, 2004 10:59 am 
Newbie

Joined: Wed Mar 24, 2004 11:13 am
Posts: 15
Location: Norcross, GA
I have Class A with an association with 2 instances of Class B.

Class A{
int id; // native generator used here
int commonID; // assigned and common to both instances of B.
B internal;
B external;
}

Upon storing Class A, I would like to persist A into 2 rows of same table as follows:
ROW1: id + commonID + internalB's values
ROW2: id + commonID + externalB's values

Is this possible? I was trying component mapping but I didn't think that the ID part will work.

Any help or suggestions are much appreciated.

Madhu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 05, 2004 2:13 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Maybe using a custom persister?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 05, 2004 2:22 pm 
Newbie

Joined: Wed Mar 24, 2004 11:13 am
Posts: 15
Location: Norcross, GA
Thanks for the quick reply.

I am not sure if I represented my situation accurately.

Upon storing Class A, I would like to persist A into 2 rows of same table as follows:
ROW1: id + commonID + internalB's values
ROW2: id + commonID + externalB's values

The "id" column in ROW 1 and ROW2 will have different values because I am using native generator.

Does your suggestion still hold good?

If so, I will look into it.

I read that there is information on this aspect on the EntityPersister.java and not much elsewhere. Is this still true?


thanks
Madhu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 5:45 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Yes, but I've never played with persister and such exotic cases, so I may be wrong.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.