-->
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.  [ 1 post ] 
Author Message
 Post subject: Could not synchronize database state with session
PostPosted: Thu Sep 17, 2015 8:54 am 
Newbie

Joined: Wed Sep 16, 2015 11:40 am
Posts: 3
[9/17/15 12:49:12:127 BST] 00000015 SystemOut O 2015-09-17 12:49:12 WARN JDBCExceptionReporter:100 - SQL Error: -911, SQLState: 40001
[9/17/15 12:49:12:128 BST] 00000015 SystemOut O 2015-09-17 12:49:12 ERROR JDBCExceptionReporter:101 - DB2 SQL Error: SQLCODE=-911, SQLSTATE=40001, SQLERRMC=2, DRIVER=3.58.81
[9/17/15 12:49:12:136 BST] 00000015 SystemOut O 2015-09-17 12:49:12 ERROR AbstractFlushingEventListener:324 - Could not synchronize database state with session
org.hibernate.exception.LockAcquisitionException: could not update: [*********]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:105)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2443)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2325)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2625)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at com.persistance.ApplicationDAOImpl.getUniqueId(ApplicationDAOImpl.java:573)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy52.getCapeUniqueId(Unknown Source)
at com.util.CapeSequenceGenerator.getCapeUniqueId(SequenceGenerator.java:32)
at com..serviceimpl.CreditApplicationServiceImpl.processAppMessage(ApplicationServiceImpl.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

Caused by:
com.ibm.db2.jcc.am.to: DB2 SQL Error: SQLCODE=-911, SQLSTATE=40001, SQLERRMC=2, DRIVER=3.58.81
at com.ibm.db2.jcc.am.ed.a(ed.java:663)
at com.ibm.db2.jcc.am.ed.a(ed.java:60)
at com.ibm.db2.jcc.am.ed.a(ed.java:127)
at com.ibm.db2.jcc.am.tm.c(tm.java:2523)
at com.ibm.db2.jcc.t4.fb.s(fb.java:940)
at com.ibm.db2.jcc.t4.fb.k(fb.java:390)
at com.ibm.db2.jcc.t4.fb.a(fb.java:61)
at com.ibm.db2.jcc.t4.t.a(t.java:50)
at com.ibm.db2.jcc.t4.vb.b(vb.java:218)
at com.ibm.db2.jcc.am.um.jc(um.java:2860)
at com.ibm.db2.jcc.am.um.b(um.java:3795)
at com.ibm.db2.jcc.am.um.ac(um.java:709)
at com.ibm.db2.jcc.am.um.executeUpdate(um.java:692)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteUpdate(WSJdbcPreparedStatement.java:1185)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:802)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:46)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2421)
... 45 more

The below is my code.

Code:
Criteria criteria = session.createCriteria(Sequence.class);
   
List capeSequence = criteria.list();   
for (Iterator iterator = capeSequence.iterator(); iterator.hasNext();) {
   Sequence uniqueSequence =(Sequence)iterator.next();
   existingId = uniqueSequence.getSequence();
   minVal=uniqueSequence.getMinVal();
   maxVal=uniqueSequence.getMaxVal();
}
if(existingId == maxVal){            
   existingId = minVal;         
}else{
   existingId = existingId+1;
}
      
Sequence eequenceObj = (CSequence) session.get(Sequence.class, SEQUENCE_NAME, LockMode.UPGRADE);
SequenceObj.setSequence(existingId);
session.update(capeSequenceObj);
session.flush();


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

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.