Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311069 - [Hibernate] Mappings with version column are fragile
Summary: [Hibernate] Mappings with version column are fragile
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Taal CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-29 13:18 EDT by Aleksander Bandelj CLA
Modified: 2019-11-08 03:14 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aleksander Bandelj CLA 2010-04-29 13:18:08 EDT
Build Identifier: 

If model has version columns, there are frequent "row was already updated or deleted by other transaction" errors. I suspect there are race conditions and clashes between Hibernate and CDO versioning. Without version columns, everything works OK.

Reproducible: Sometimes

Steps to Reproduce:
Extending org.eclipse.emf.cdo.examples.company model with version column would probably expose most of these bugs
Comment 1 Aleksander Bandelj CLA 2010-04-30 08:04:46 EDT
I've discovered that CDO/Teneo adds always_version if not present. So, example model (and every model) is versioned. Actually, proper working of CDO/Teneo depends on versioning being present, as I discovered in HibernateStoreAccessor#write:

      // first decrease the version for all dirty objects
      // hibernate will increase it again
      for (CDORevision revision : context.getDirtyObjects())
      {
        if (revision instanceof InternalCDORevision)
        {
          InternalCDORevision internalRevision = (InternalCDORevision)revision;
          internalRevision.setVersion(internalRevision.getVersion() - 1);
        }
      }

So, I'm closing this bug.
Comment 2 Martin Taal CLA 2010-04-30 09:07:48 EDT
Re-opening the issue as it warrants some more study (and an update of the wiki).

gr. Martin
Comment 3 Aleksander Bandelj CLA 2010-04-30 10:16:40 EDT
For the time being, I would put two notes in the CDO/Teneo store wiki:

- annotated version attribute in ecore model seems to break things
- always_version is set for you (if not set explicity) and you should never it to false
Comment 4 Martin Taal CLA 2010-05-01 03:56:21 EDT
Remark from Eike in the newsgroup:
I'm not so sure whether modeled version attributes are a good idea. How can we ensure that their values are confirming to CDO's interpretation?

And if you want to exclude certain things (like modeled versions) I think it's better to write code that enforces the rule, not just docs ;-) 

gr. Martin
Comment 5 Martin Taal CLA 2010-05-01 04:07:07 EDT
Aleksander can you change the description to use the prefix: [Hibernate]? Then it will show up in the right list for me.

gr. Martin
Comment 6 Eike Stepper CLA 2010-05-01 04:24:51 EDT
;-)
Comment 7 Martin Taal CLA 2010-05-01 04:26:55 EDT
ha the edit link next to the description, sometimes live is soooo simple (only if I would see it) :-)
Comment 8 Eike Stepper CLA 2012-06-05 07:31:16 EDT
Moving all open bug reports to 4.1 because the release is very near and it's hghly unlikely that there will be spare time to address 4.0 problems.

Please make sure that your patches can be applied against the master branch and that your problem is not already fixed there!!!
Comment 9 Eike Stepper CLA 2012-08-14 22:58:21 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 10 Martin Taal CLA 2012-11-24 08:59:08 EST
Modeled version attributes are not supported in the CDO Hibernate Store. I pushed several changes to let optimistic locking work correctly using the CDO version number. This is available in the next build.
Comment 11 Eike Stepper CLA 2013-05-20 03:17:49 EDT
Mass update. Don't worry if this bug is already closed!