-->
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.  [ 5 posts ] 
Author Message
 Post subject: Sybase not able to get exclusive locks usingLOCKMODE.UPGRADE
PostPosted: Thu Sep 28, 2006 5:30 am 
Newbie

Joined: Wed Sep 27, 2006 11:54 pm
Posts: 3
Location: India
In my application I am connecting to Sybase database from hibernate.I tried setting locks using
1.session.load(class,id,LOCKMODE.UPGRADE)
2.session.lock(obj,LOCKMODE.UPGRADE)

I tested the lock using threads ,but its not locking the rows.All the thread are being given shared lock.So wen i update the value differs.I have set the transaction isolation level using
<property name="hibernate.connection.isolation">
but stilll its not locking the row..
Can anyone advice on what can be done to get an exclusive lock on one record.Is it sybase specific problem.??


Top
 Profile  
 
 Post subject: LockAcquisitionException( deadlock situation)
PostPosted: Wed Oct 04, 2006 5:34 am 
Newbie

Joined: Wed Sep 27, 2006 11:54 pm
Posts: 3
Location: India
my requirement was that i wanted to do a select for update.I should acquire lock on certain rows and do a matching and if concurrent request comes ,it should wait till transaction is over that is lock is released.

When I went through the hibernate code,the hibernate is making static queries in the beginning while loading session factory.Since we are appending the holdlock during execution,the sybase dialect is not appending.
As a work around I tested with native sql with holdlock but when I test concurrent request using threads its bombing.Its throwing LockAcquisitionException.( Your server command (family id #0, process id #3777) encountered a deadlock situation.).can anyone give a solution to this problem???


org.hibernate.exception.LockAcquisitionException: could not update: [com.citco.aexeo.common.dataaccess.domain.Fund#12]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:84)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2223)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2375)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:91)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:233)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:107)
at com.satyam.Testing.doTransaction(Testing.java:103)
at com.satyam.MyRunnable.run(MyRunnable.java:13)
at java.lang.Thread.run(Thread.java:568)
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: Your server command (family id #0, process id #3777) encountered a deadlock situation. Please re-run your command.

at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1642)
at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1625)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:91)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2205)
... 14 more


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 11, 2006 9:12 am 
Newbie

Joined: Wed Sep 27, 2006 11:54 pm
Posts: 3
Location: India
After trying out different possibilities we found that pessimisstic locking is working fine with jre1.5 but not working for jre1.4.Can anyone help on why its not working with jre 1.4....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 23, 2007 7:17 am 
Newbie

Joined: Mon Jan 29, 2007 7:29 am
Posts: 6
did u find the solution for this???
i m also facing the same problem..
plz help me if u have any clue regarding the same


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 5:51 pm 
Newbie

Joined: Fri Mar 02, 2007 5:32 pm
Posts: 1
Hi Sameer11sep,

You can read my opinion about this problem here: http://opensource.atlassian.com/project ... e/HHH-2131

I think that's it's an Hibernate Bug.

I Watch the issue and wait for an Hibernate Team Member response.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.