-->
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.  [ 1 post ] 
Author Message
 Post subject: Managing multiple class versions
PostPosted: Sun Jan 17, 2010 8:34 am 
Beginner
Beginner

Joined: Mon Jan 04, 2010 2:52 pm
Posts: 30
hello,

I use hibernate with an in-process HSQLDB in my application to save
projects (an instance of Project with about 7 other classes involved) to
disk. Obviously the structure of these classes may change.

So when loading a project from hibernate persistence, I need to check the
version of each class (instance variable 'version' that is persisted),
and load the class matches the version:

My idea is to create a subclass of each class that has changed
(i.e. ProjectV2 extends Project, ProjectV3 extends ProjectV2 and so on),
and when loading a project, read the version-number, load the appropriate
class (i.e. ProjectV2) using hibernate, and then convert it to the current
version using a constructor (i.e. ProjectV3).

My question is:
Is there a better way to do this, or a feature in hibernate that makes this
easier?

Thanks in advance!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.