Hi,
I have the following code for delete
public Object delete(Object object)throws Exception{
Application application = null;
Long applicationId = null;
try{
long memberId =
((ApplicationMember)object).getApplicationMemberID();
ApplicationMember member =
entityManager.find(ApplicationMember.class, memberId);
applicationId =
member.getApplication().getApplicationId();
application = new Application();
application.setApplicationId(applicationId);
entityManager.remove(member);
}
catch (Exception e) {
e.printStackTrace();
}
return application;
}
While performing the above operation, OpenJPA intermittently gives the below
exception
Caused by: <openjpa-1.2.0-r422266:683325 nonfatal store error> org.apache.openjp
a.persistence.OptimisticLockException: An optimistic lock violation was detected
when flushing object instance "com.org.member.Name-us.
com.org.member.Name-902" to the data store. This indicate
s that the object was concurrently modified in another transaction.
FailedObject: com.org.member.Name-com.org.member.Name-902
And I have the following settings in my persistence.xml file
<property name="openjpa.LockManager"
value="pessimistic(VersionCheckOnReadLock=none,VersionUpdateOnWriteLock=none)"/>
Could some one please help me come out of this problem? I am posting after 2
days of hard work googling all the forums.
Thanks,
JP
--
View this message in context:
http://n2.nabble.com/Optimistic-locking-exception-while-performing-a-delete-tp2566822p2566822.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.