-->
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.  [ 5 posts ] 
Author Message
 Post subject: Entity across several tables
PostPosted: Wed Oct 01, 2003 7:33 pm 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
hi!

Is there a way in hibernate to map an entity across two tables (the tables referenced by a foreign key, of course).

Thanks!

_________________
Mauricio Hern


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2003 4:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please see "delegate" pattern on the Wiki.


Top
 Profile  
 
 Post subject: Thanks for the help!
PostPosted: Thu Oct 02, 2003 10:23 am 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
Thanks Gavin!!!

To those of you who wanna find out where the wiki for delegate pattern is:
http://www.hibernate.org/45.html

_________________
Mauricio Hern


Top
 Profile  
 
 Post subject: a similar problem
PostPosted: Wed Oct 29, 2003 7:18 pm 
Newbie

Joined: Wed Oct 29, 2003 6:50 pm
Posts: 3
I have a similar problem.
I read the "delegate" pattern and it doesn't work for me.
The problem is that the example is using the
<generator class="assigned"/>
I think it should use "foreign". With "assign" I have to assign the id manually.
Example:
session.save(customer);
customerHistory.setId(customer.getId());
session.save(customerHistory);
I think this doesn't look good. What if I have 5 objects like CustomerHistory?
I may be wrong, I am newbie with the hibernate. I accept any notes on that (on my English too).
I know that I can use joined-subclass. But it is not good for me too.
I have the following problem:
3 tables

EMAILS, EMAIL_BODY and EMAIL_SOURCE.

They all have primary key EMAIL_ID and the relation is one-to-one.
How can I do without double extending the Email object in JAVA. I
I would like to use lazy loading of the EMAIL_BODY and EMAIL_SOURCE objects.

Thanks in advance to any response.


Top
 Profile  
 
 Post subject: and...
PostPosted: Wed Oct 29, 2003 7:36 pm 
Newbie

Joined: Wed Oct 29, 2003 6:50 pm
Posts: 3
I tried OJB before hibernate and I was not able to that again.
I used many-to-one relation and with some methods added it worked good.
I'm sure this workaround will work with hibernate too.


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