• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

object locking of entity bean instance in a SSBean[Environment: WebLogic 10.0, EJB3.0, Kodo/OpenJPA]

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

Hello friends,

I am facing bottle neck with Object Locking for an Entity bean using OpenJPA Persistence Manager under Weblogic 10.0 application server deployments.

I want to block [ for the specific method ] entity bean being accessed from other client programs when they invoke common method in a Stateless Session EJB. Particularly, Consider the situation:

Client1: Modifying Customer entity with id: 100. Then I locked that entity using OpenJPA Entity Manager within the transaction block. And i entered that thread to sleep before committing the transaction.

At this time, started new thread, Client2: Modifying the same Customer entity with id:100. I expected this thread will be get blocked when control pass to the lock() method. But it doesn't happened. It goes through the line of codes and also put into sleep.

After thread sleep timeout, first thread Client1 commit successfully. But the second gets Rollback Exception due to optimistic lock exception occurring since customer entity is modified in another transaction.

This exception is occurred because of Database level concurrency control for optimistic locking in a weblogic server. Its default to weblogic.

But, what i expected is to assert lock at the object level, thereby the 2nd thread - Client2 will be blocked while Client1 is in the middle of a transaction and then Client2 use modified Customer entity . But it doesn't happened. I used Kodo Persistance Provider as Persistence Unit, OpenJPAEntityManager to do transaction, locking , finding and merging the entity bean.

Can anyone provide help to fine grain this object locking functionality ??? I look forward to your brilliant thoughts......



Rajesh KR
Geojit Technologies
 
Rajesh Kottayil
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajesh Kottayil wrote:
Hello friends,

I am facing bottle neck with Object Locking for an Entity bean using OpenJPA Persistence Manager under Weblogic 10.0 application server deployments.

I want to block [ for the specific method ] entity bean being accessed from other client programs when they invoke common method in a Stateless Session EJB. Particularly, Consider the situation:

Client1: Modifying Customer entity with id: 100. Then I locked that entity using OpenJPA Entity Manager within the transaction block. And i entered that thread to sleep before committing the transaction.

At this time, started new thread, Client2: Modifying the same Customer entity with id:100. I expected this thread will be get blocked when control pass to the lock() method. But it doesn't happened. It goes through the line of codes and also put into sleep.

After thread sleep timeout, first thread Client1 commit successfully. But the second gets Rollback Exception due to optimistic lock exception occurring since customer entity is modified in another transaction.

This exception is occurred because of Database level concurrency control for optimistic locking in a weblogic server. Its default to weblogic.

But, what i expected is to assert lock at the object level, thereby the 2nd thread - Client2 will be blocked while Client1 is in the middle of a transaction and then Client2 use modified Customer entity . But it doesn't happened. I used Kodo Persistance Provider as Persistence Unit, OpenJPAEntityManager to do transaction, locking , finding and merging the entity bean.

Can anyone provide help to fine grain this object locking functionality ??? I look forward to your brilliant thoughts......



Rajesh KR
Geojit Technologies






Hello frndz,
I need your help to solve this problem of "Object Locking", please anyone who had worked with object locking of Entity Beans in an enterprise application development, please give light to this thread....



please help......
Rajesh


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic