-->
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.  [ 3 posts ] 
Author Message
 Post subject: Version Requirement for the entire application
PostPosted: Mon Nov 28, 2005 3:55 am 
Newbie

Joined: Mon Nov 21, 2005 6:15 am
Posts: 14
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

I have a versioning requirement like this. (This is not versioning of an object but it is versioning of the entire application.) Let us assume you have a schema like this,

User -> Order -> OrderLine ->Items

User(user_id, user_name, app_version)
Order(order_id, order_details, user_id, app_version)
OrderLine(order_line_id, order_line_details, order_id, app_version)
Items(item_id, item_details, app_version)

Basically when i start the app_version is say "1.0" and order system proceeds as usual. At any point of time let us say i freeze the entire application to take statistics data. So what i do is i increment the app_version to 2.0. For this i make a copy of "entire data" all tables and put the app_version field to be 2.0. At the global application level i would have specified the app_version and the where clause should be applied for each and every query that is being fired.

Now here comes the problem. when i mark a new version, i want to make a copy of the existing data (forgetting the primary keys and saving them as new). Also if Order (app_version 1.0) refers an user say "User1" in app_version 1.0 then in the version 2.0 it must refer "User1" row in app_version 2.0.

I understand this is a complex requirement. However the size of the database will not be a problem because the total chunk of data will be of the order of 10mb with each table having 2000 rows at a maximum.

My Questions,
1) How can i take a graph of objects and say "Save it as if it where a new object but with app_version as 2.0". I took a look at calls like "replicate()" and "XML passivation of data". But they seem to be doing the job of transferring object across different data sources. I basically need a copy in the home database itself.

2) More importantly when i take a graph of data and save as new i dont want dangling references to old data. For example,
User (XYZ, appversion1) has orders (Order1, appversion1, XYZ) and (Order2, appversion1, XYZ)
when i copy the complete graph has to "intelligently update the references" and the result must be something like,
User (XYZ, appversion2) having orders (Order1, appversion2, XYZ) and(Order2, appversion2, XYZ)
and the old row also will reside in the same database.

Are there some solutions to this?

I *perfectly understand* that it will be quite complex and i might have to do lot of coding and testing. Essentially, i want some guidelines/how tos to start with.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 5:33 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
use composite primary id and add app_version in every pk
then set app_version in any static variable

you will need write procedure for upgrade version, only


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 5:45 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
You do not need any code to solve this issue, probably all dabases support this feature


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