• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sun Application Server - Select For Update

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic