• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB-QL / findForUpdate methods

 
J Waldinger
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am converting an application with EJB 1.1 to EJB 2.0. In my original EJB's, I have several findForUpdate methods defined for my CMP Entity beans. However, EJB2.0 and EJB-QL doesn't seem to support the "FOR UPDATE" clause in the ejb-ql statements. How do I is this done in EJB 2.0 ?
Thanks,
Jamie
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need FOR UPDATE. If you update the Entity data the ejbStore method will be invoked in any case?
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Why do you need FOR UPDATE. If you update the Entity data the ejbStore method will be invoked in any case?

One would want to execute a SELECT FOR UPDATE statement to implement pessimistic locking.
Unfortunately, EJB-QL does not support the SELECT FOR UPDATE construct because it is supposed to be independent of SQL. However, many Application Servers do indeed support pessimistic locking in some form or another. Check the documentation for your Application Server.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Were your Original 1.1 beans CMP or BMP?
 
J Waldinger
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My 1.1 beans were CMP. And WebSphere is my application server. The application was coded to use these findForUpdate() methods throughout - although I'm not certain what the impact would be of replacing them with regular finder methods.
It appears that the WebSphere implementation of this is called 'Access Intents'. There are 6 different kinds of access intent - I'm guessing that the one I want is: wsPessimisticUpdate.
Jamie
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I havent worked on websphere but read this link
http://publib7b.boulder.ibm.com/wasinfo1/en/info/ae/ae/rdat_isolevtab.html
May be not of much help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic