org.hibernate.exception.LockAcquisitionException: could not update: [com.citco.aexeo.common.dataaccess.domain.Fund#12]

Hibernate JIRA | George Thomas | 1 decade ago
  1. 0

    I am connecting to Sybase database from hibernate.I tried setting locks using while selecting rows 1.session.load(class,id,LOCKMODE.UPGRADE) 2.session.lock(obj,LOCKMODE.UPGRADE) I am attaching a sample code while updating a field in table fund after selecting it. { Fund fund = null; ClientCredential credential = new ClientCredential("testDatabase", fund); org.hibernate.Session session = SessionFactoryManager.getSessionFactory(credential).getCurrentSession(); Transaction transaction = session.beginTransaction(); log.info("Run by " + Thread.currentThread().getName()); fund = (Fund) session.get(Fund.class, new Short((short)12), LockMode.UPGRADE); fund.setLegalEntityOrgId(fund.getLegalEntityOrgId()+1); transaction.commit(); } 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

    Hibernate JIRA | 1 decade ago | George Thomas
    org.hibernate.exception.LockAcquisitionException: could not update: [com.citco.aexeo.common.dataaccess.domain.Fund#12]
  2. 0

    I am connecting to Sybase database from hibernate.I tried setting locks using while selecting rows 1.session.load(class,id,LOCKMODE.UPGRADE) 2.session.lock(obj,LOCKMODE.UPGRADE) I am attaching a sample code while updating a field in table fund after selecting it. { Fund fund = null; ClientCredential credential = new ClientCredential("testDatabase", fund); org.hibernate.Session session = SessionFactoryManager.getSessionFactory(credential).getCurrentSession(); Transaction transaction = session.beginTransaction(); log.info("Run by " + Thread.currentThread().getName()); fund = (Fund) session.get(Fund.class, new Short((short)12), LockMode.UPGRADE); fund.setLegalEntityOrgId(fund.getLegalEntityOrgId()+1); transaction.commit(); } 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

    Hibernate JIRA | 1 decade ago | George Thomas
    org.hibernate.exception.LockAcquisitionException: could not update: [com.citco.aexeo.common.dataaccess.domain.Fund#12]
  3. 0

    Length of Bind host variable exceeds MaxLength

    Stack Overflow | 7 years ago | janetsmith
    com.sybase.jdbc2.jdbc.SybSQLException: ASA Error -1001019: Function not supported on varchars longer than 255 Length of Bind host variable exceeds MaxLength , -- (df_Heap.cxx 2145)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Transient Sybase SET CHAINED Tx exception.

    Oracle Community | 1 decade ago | 3004
    com.sybase.jdbc2.jdbc.SybSQLException: Stored procedure 'sp_validate_data' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.
  6. 0

    Operand type clash: TEXT is incompatible with IMAGE @ approx 20K

    Google Groups | 2 decades ago | Adam Jack
    com.sybase.jdbc2.jdbc.SybSQLException: Operand type clash: TEXT is incompatible with IMAGE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. 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()
    2. com.sybase.jdbc2
      SybPreparedStatement.executeUpdate
      1. com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)
      2. com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)
      3. com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
      4. com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
      5. com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
      6. com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1642)
      7. com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1625)
      8. com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:91)
      8 frames
    3. Hibernate
      AbstractEntityPersister.update
      1. org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
      2. org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2205)
      3. org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
      4. org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2375)
      4 frames
    4. Hibernate
      EntityUpdateAction.execute
      1. org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:91)
      1 frame
    5. Hibernate
      ActionQueue.executeActions
      1. org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
      2. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:233)
      3. org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
      3 frames
    6. Hibernate
      SessionImpl.managedFlush
      1. org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
      2. org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
      3. org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
      4. org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
      4 frames
    7. Hibernate
      JDBCTransaction.commit
      1. org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:107)
      1 frame
    8. com.satyam
      MyRunnable.run
      1. com.satyam.Testing.doTransaction(Testing.java:103)
      2. com.satyam.MyRunnable.run(MyRunnable.java:13)
      2 frames
    9. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:568)
      1 frame