-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: LockAcquisitionException on delete
PostPosted: Mon Jan 29, 2007 5:15 am 
Newbie

Joined: Fri Dec 15, 2006 6:08 am
Posts: 18
Location: France
Hi,
I have a small program which is persisting an object in database then delete it just after (ok, it makes no
sense but it's just for testing purpose!).
Here is the code :

public void run() {
// create alarm
Alarm alarm = new Alarm();
alarm.setName("new");
Alarm created = service.create(null, null, alarm);

// get primary key of created alarm
Long pk = created.getOid();

// delete alarm
service.delete(pk);
} catch (Exception e) { ...}
}

To simulate several clients, this code is executed in a thread.
My problem is that if I execute this program with more than 3 threads, I get an hibernate
LockAcquisitionException caused by an oracle exception : ORA-00060: deadlock detected while waiting for resource.

I don't understand why I have this problem with a so simple program.

Any ideas?


Hibernate version: 3.2.0

Full stack trace of any exception that occurs:
org.hibernate.exception.LockAcquisitionException: could not delete: [net.ejb.model.alarm.Alarm#40726]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:87)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2491)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2647)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
Caused by: java.sql.SQLException: ORA-00060: deadlock detected while waiting for resource

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3400)
at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate(P6LogPreparedStatement.java:183)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2473)

Name and version of the database you are using:Oracle 10


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 5:39 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
From your code it is not clear, if you commit transactions or not. If your delete stays uncommited, you may receive a lock.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 31, 2007 9:41 am 
Newbie

Joined: Fri Dec 15, 2006 6:08 am
Posts: 18
Location: France
I have found the problem.
It comes from an oracle parameter called initrans which must be increased.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.