-->
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: hib updates view-hidden row regardless the version
PostPosted: Thu Oct 20, 2005 12:28 pm 
Beginner
Beginner

Joined: Mon Sep 15, 2003 12:41 pm
Posts: 21
We have a legacy db schema. To isolate our changes from actual tables we created a set of VIEWs. Then we map hibernate to VIEWs, and everything works fine, except one subtle concurrency scenario: "A deletes, B updates". We use optimistic concurrency with <version> field.

I.e.:

CREATE VIEW V_FOO AS select * from T_FOO WHERE DELETED != 'Y'

User A: loads record R with version 1
User B: loads record R with version 1
User A: sets DELETED to 'Y', commit (this increments R version to 2)
VIEW: makes R disappear, but the row is still in T_FOO of course
User B: attempts to merge R, and -- a bug? -- row gets updated!

Note: when Hibernate was mapped to actual table, not view, attempt to update the row was raising an exception.

Presumably Hibernate cannot find R in the view, and decides that null version is okay. I expect Hibernate to throw some kind of exception at this point.

Am I wrong in my expectations?


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.