-->
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: 1 entity - 2 tables
PostPosted: Sun Sep 17, 2006 3:01 am 
Newbie

Joined: Sat Sep 16, 2006 8:05 am
Posts: 2
Hibernate version: in JBoss 4.0.4ga

Name and version of the database used: Oracle 10 XE

Hi,
I was digging around the docs, but still unable to answer this one.

Is it posible to map the same POJO class on 2 tables with the same structure. It's not an example of inheritance or splitting data from one class on several tables. Is it possible to save the same type of entities in diffrent tables? And if it is, what annotation && EntityManager behaviour would it take to work (I can probably find that on my own, but can someone just tell me if I'm on a wild goose chase)?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 17, 2006 10:22 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
it is possible through entity-name but not with annotations, you'll have to use hbm.xml files

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 18, 2006 6:39 pm 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
what about @SecondaryTable ?

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 4:57 am 
Newbie

Joined: Sat Sep 16, 2006 8:05 am
Posts: 2
Tnx emmanuel, I'll have to digg some more to make it work. I was working with annotations from the start, so I have to look into xml configurations.

@SecondaryTable would split fields of one instance over several tables. I need to store a whole instance either in table1 or table2.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 4:33 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Hi,

I also have the same requirement to save a complete entity in 2 tables, and I currently trying to get it to work with entity-name in hbm.xml mapping files (and the hibernate mbean).

I read this page
http://www.hibernate.org/hib_docs/v3/reference/en/html/persistent-classes.html#persistent-classes-dynamicmodels
And saw it used a Session object and Transaction object to save the maps, but i would like to get it to work with the EntityManager i.e. em.Persist(), is this possible ??

Cheers,

Andy


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.