• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to implement Object Locking to entity bean???

 
Rajesh Kottayil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello Frndz.

I tried to optimize concurrency control through Object Locking at application level. Overriding Database Locking by default. But, the Object Locking doesn't worked. And the default database locking worked. But I wanted application level locking of object/record/column of a table and not the commit time locking.

Can anyone give working example to Object Locking???

regards,
RajeshKR

 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you try that didn't work? What was the error that was generated?

-Cameron McKenzie
 
Rajesh Kottayil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cameron Wallace McKenzie wrote:What did you try that didn't work? What was the error that was generated?

-Cameron McKenzie




Hello Cameron,

There was no error. But the locking was not worked as expected. Scenario is,

I am using the lock method of OpenJPAEntityManager like this:

openjpainstance.lock(entityinstance,LockModeType.Write, -1);

and after this ... i am updating the entity and merging it.

then before commit() statement , i put the thread to sleep for 10sec. so that i can start another

client thread to modify the same entity. And it also executes up to the sleep method.

But, what i expected that , it will be blocked when execution gets to :

openjpainstance.lock(entityinstance,LockModeType.Write,4000); line of code.

And this doesn't happened. As its described in theories.

please provide your great thoughts....


regards,
Rajesh

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic