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 21:03 Go to next message
andiqo  is currently offline andiqo Friend
Messages: 32
Registered: July 2009
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.

// -- 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 14:38 Go to previous message
James Sutherland is currently offline James SutherlandFriend
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

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 : Wiki : Book : Blog : Twitter
Previous Topic:How to configure query cache invalidation with JPA queries?
Next Topic:force the connection
Goto Forum:

Current Time: Thu Nov 26 14:20:18 GMT 2015

Powered by FUDForum. Page generated in 0.03085 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software