• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sun Application Server - Select For Update  RSS feed

 
Safin Ahmed
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

How can i achieve a Select For Update in a Sun Application Server ?

In Web Logic, there is a Tags in the Descriptor file, in WebSphere there is something called Access Intents

How can i do it in Sun Application Server?

Thank you
 
Safin Ahmed
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For everyone out there with the same questions
The answer is in the sun-cmp-mapping.xml file
you can use the consistency tag, inside an <entity-mapping>
And the consistency tag has two options, one of them is <lock-when-loaded> that is equivalent to select for update

See http://java.sun.com/j2ee/1.4/docs/devguide/dgcmp.html for all tag in consistency

So the code would be something like

<entity-mapping>
<ejb-name>NAME</ejb-name>
<table-name>TABLE_NAME</table-name>
<cmp-field-mapping>
<field-name>FIELD</field-name>
<column-name>TABLE_NAME.FIELD</column-name>
<fetched-with>
<default/>
</fetched-with>
</cmp-field-mapping>
.
.
.
<consistency>
<lock-when-loaded />
</consistency>

Note: This wasn't tested yet, so i'm not 100% that lock-when-loaded is equal to select for update. But i'm 100% sure it is
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!