File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB-QL / findForUpdate methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB-QL / findForUpdate methods" Watch "EJB-QL / findForUpdate methods" New topic
Author

EJB-QL / findForUpdate methods

J Waldinger
Greenhorn

Joined: Sep 05, 2003
Posts: 12
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

Joined: Feb 27, 2002
Posts: 8919

Why do you need FOR UPDATE. If you update the Entity data the ejbStore method will be invoked in any case?


Groovy
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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

Joined: Feb 27, 2002
Posts: 8919

For weblogic 7.0
http://edocs.bea.com/wls/docs70/ejb/EJB_reference.html#1131565
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Were your Original 1.1 beans CMP or BMP?
J Waldinger
Greenhorn

Joined: Sep 05, 2003
Posts: 12
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

Joined: Feb 27, 2002
Posts: 8919

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB-QL / findForUpdate methods