openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Optimistic locking exception while performing a delete
Date Wed, 01 Apr 2009 15:06:46 GMT

Hi,
> OpenJPA intermittently gives the below exception 
*intermittently* worries me.
Post the domain classes Application+ApplicationMember with their mapping meta-data, and we
will take a look.



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




-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/Optimistic-locking-exception-while-performing-a-delete-tp2566822p2569583.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message