Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

about Entity relationship locks when Pessimisitc_write is set for an entity instance  RSS feed

 
Ranch Hand
Posts: 1701
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In test 1 of Enthuware, it points out that


When an entity instance is locked using pessimistic locking, the persistence provider must lock the database row(s) that correspond to the non-collection-valued
persistence state of the instance...... Entity relationships for which the locked entity contains the foreign key will also be locked, but not the state of the referenced entities....



I tried the example in ToyAppForJPA,




Suppose, I have CustOrder id =1, Address_ID = 1.
And also I have Address id=1, zipcode = 11111 and Address id =2, zipcode = 22222.

I expect there will be an exception thrown when I attempt to change CustOrder id 1's address from 1 to 2 because the spec says the entity relationship is locked as the lock mode is set as PESSIMISTIC_WRITE.
I don't know why I can successfully change the address for CustOrder 1 ?

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!