-->
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.  [ 6 posts ] 
Author Message
 Post subject: Moving objects between different tables
PostPosted: Mon Apr 03, 2006 5:06 am 
Newbie

Joined: Mon Apr 03, 2006 4:54 am
Posts: 4
For a road traffic information management application we need to retain created objects for archiving purposes, therefore we have 'active' objects and 'archived' objects, only distingued by a flag.
The object graph is quite complex.
Is there a method to move archived objects (for performance reasons) from one sets of tables to another one without creating a fake class hierarchy?
Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 5:25 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
You may try entity names for this purpose.
The mapping will look like:

Code:
<class name="MyClass"
entity-name="MyEntity"
      table="mytable">


Saving is like:

Code:
session.save("MyEntity", myClass);


Just as a starter.

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 9:46 am 
Newbie

Joined: Mon Apr 03, 2006 4:54 am
Posts: 4
Looks interesting, thanks.
One question: In such a case how can I manage one-to-many and many to many relationships? The objects they point to are supposed to be archived as well.

steckemetz wrote:
You may try entity names for this purpose.
The mapping will look like:

Code:
<class name="MyClass"
entity-name="MyEntity"
      table="mytable">


Saving is like:

Code:
session.save("MyEntity", myClass);


Just as a starter.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 11:45 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
I never used collection mapping togehter with entity-names,
but the documentation says e.g. for many-to-one:

Code:
<many-to-one
...
        entity-name="EntityName"           

that you can specify an entity name.
Hope this helps.

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 1:54 pm 
Newbie

Joined: Mon Apr 03, 2006 4:54 am
Posts: 4
Thanks.
One final question: how can this be applied to ejb3?

steckemetz wrote:
I never used collection mapping togehter with entity-names,
but the documentation says e.g. for many-to-one:

Code:
<many-to-one
...
        entity-name="EntityName"           

that you can specify an entity name.
Hope this helps.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 3:11 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
I do not use ejb3,
but there might be some annotations for entity-names.

_________________
dont forget to rate !


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