-->
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: Session per request with detached objects and legacy data
PostPosted: Thu Mar 03, 2005 12:39 pm 
Newbie

Joined: Mon Sep 20, 2004 6:58 am
Posts: 6
For session-per-request-with-detached-objects the only locking mechanism is with managed versioning. This means that legacy databases cannot be used with this type of session scope. Isn't that a huge drawback ? Couldn't it be solved easily with an extra (hidden) property in a POJO that represents the original state of it (for example a MD5 or CRC property) ?

Regards,

Sytze.

Hibernate version:
2.1.7
Mapping documents:
N/A
Code between sessionFactory.openSession() and session.close():
N/A
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
N/A
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 12:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well if you can add a hidden MD5 field, you can also add a hidden version field.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 12:48 pm 
Newbie

Joined: Mon Sep 20, 2004 6:58 am
Posts: 6
AFAIK, the version field will be stored in the database. For legacy data, this is often not an option. What I mean, is a field that is not stored in the database, but calculated at retrieval and storage time from the data in the database. At storage time, the MD5 field of the POJO would be compared to the MD5 value calculated from the current data in the database.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 1:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This would not really help, because you need to know if the database was updated in the meantime, not if the pojo was updated in the meantime.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 1:12 pm 
Newbie

Joined: Mon Sep 20, 2004 6:58 am
Posts: 6
True. To detect changes in the database, one would calculate the MD5 value of the current data. If that value does not match with the MD5 from the POJO, the database had changed in the mean time. Which is still better than having no support for session p/request with detached object and legacy databases at all, I think.


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.