Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315067

Summary: [Hibernate] Store version in a non-version property, disable/remove Hibernate optimistic locking
Product: [Modeling] EMF Reporter: Martin Taal <mtaal>
Component: cdo.coreAssignee: Martin Taal <mtaal>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 Flags: stepper: review+
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Hibernate Store Patch
none
Small patch for cdo testcases
none
Combined patch v2 - ready to be committed none

Description Martin Taal CLA 2010-05-31 08:25:34 EDT
The CDO Hibernate Store makes use of Hibernate optimistic locking. For this the version number passed in by CDO to the storage layer is used. Hibernate updates the version when updating information in the database. 
For fault free operation it is critical that the hibernate generated version number is the same as the one passed in by CDO. 

It shows that the mechanism of keeping the hibernate version number in sync with CDO's version number is not fault proof and that there are special cases where the version number in Hibernate is not increated while CDO expects an increase in version number.

This bugzilla proposes to store the CDO version as a normal property in the database. This means that Hibernate optimistic locking is disabled. 

The impact of this is considered to be minimal as:
- version checking is already done in the CDO layer, so having this in Hibernate is less needed and only results in extra overhead.
- for backward compatibility the version colum name is used.
Comment 1 Martin Taal CLA 2010-05-31 09:37:45 EDT
Created attachment 170524 [details]
Hibernate Store Patch
Comment 2 Martin Taal CLA 2010-05-31 09:38:35 EDT
Created attachment 170525 [details]
Small patch for cdo testcases

This patch contains some small enhancements for enabling the testcases for Hibernate
Comment 3 Martin Taal CLA 2010-05-31 09:40:08 EDT
The CDO Hibernate store patch also contains fixes for the following 2 issues:
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=301339
[Hibernate] Write Default Value from Client to Server
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=313539
[Hibernate] NonUniqueObjectException when saving a model with cyclical references
Comment 4 Eike Stepper CLA 2010-05-31 11:28:29 EDT
Created attachment 170541 [details]
Combined patch v2 - ready to be committed

Just a few reformats ;-)
Comment 5 Martin Taal CLA 2010-05-31 12:42:46 EDT
Patch committed
Comment 6 Eike Stepper CLA 2010-06-29 04:35:36 EDT
Available in 3.0 GA:
http://download.eclipse.org/modeling/emf/cdo/updates/3.0-releases/