Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Optimistic locking without EclipseLink dependency in my domain objects?
Optimistic locking without EclipseLink dependency in my domain objects? [message #386068] Wed, 25 March 2009 17:03 Go to next message
andiqo  is currently offline andiqo
Messages: 32
Registered: July 2009
Member
I have a simple DataModel mapped in relational databases using OpenJpa /
JPA 2.0 . I wanted to use EclipseLink 2.0.0 M1 but I couldn't find a way
to define optimistic locking without adding @OptimisticLocking in my
domain objects. Is there a possibility to define optimistic locking in the
persistence.xml file only?

Thanks a lot for your help.
Regards,
Nicolas

// -- My OpenJpa persistence.xml

<!-- Transaction -->
<property name="openjpa.Optimistic" value="true" />
<property name="openjpa.RetainState" value="true" />
<property name="openjpa.jdbc.DBDictionary"
value=" org.apache.openjpa.jdbc.sql.PostgresDictionary(BatchLimit=20 0) " />
<property name="openjpa.jdbc.TransactionIsolation" value="repeatable-read"
/>

<!-- Cache -->
<property name="openjpa.QueryCache" value="true" />
<property name="openjpa.DataCache" value="true" />
<property name="openjpa.RemoteCommitProvider" value="sjvm" />
<property name="openjpa.BrokerImpl" value="EvictFromDataCache=true" />
Re: Optimistic locking without EclipseLink dependency in my domain objects? [message #386070 is a reply to message #386068] Thu, 26 March 2009 10:38 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

What does this option do exactly in OpenJPA, I could not find any useful
documentation on it. It seems that it is the default in JPA, so does
nothing?

In JPA to version lock an object you must use the @Version annotation or
orm.xml <version> on a version field in your object. This version will be
checked on any update or delete operation.

The @OptimisticLocking option in EclipseLink allows configuring
field-level optimistic locking, if you do not have a version column. You
can also configure this in EclipseLink's orm.xml, or using a
DescriptorCustomizer or SessionCustomizer you could set this on all of
your descriptors if you so desired.

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Previous Topic:How to configure query cache invalidation with JPA queries?
Next Topic:force the connection
Goto Forum:
  


Current Time: Sun Apr 20 04:18:10 EDT 2014

Powered by FUDForum. Page generated in 0.05726 seconds