Skip to main content



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


Current Time: Wed Jul 23 14:29:23 EDT 2025

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

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

Back to the top