Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: hibernate session
PostPosted: Mon Nov 13, 2006 7:33 pm 
Newbie

Joined: Mon Aug 07, 2006 7:14 pm
Posts: 16
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:3.0[/b]

[b]
org.hibernate.exception.GenericJDBCException: could not update: [com.myApp.model.ProcessAudit#3363]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2222)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:951)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:109)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:819)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:817)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:813)
at com.myApp.dao.hibernate.PageDAOHibernate.getSitePages(PageDAOHibernate.java:14)
at com.myApp.service.impl.GoldWordAuditService.createMapOfPages(GoldWordAuditService.java:183)
at com.myApp.service.impl.GoldWordAuditService.executeAudit(GoldWordAuditService.java:383)
at com.myApp.service.system.client.ProcessAuditClient.executeAudits(ProcessAuditClient.java:309)
at com.myApp.service.system.client.ProcessAuditClient.processAllSitesAudits(ProcessAuditClient.java:154)
at com.myApp.service.system.client.ProcessAuditClient$$FastClassByCGLIB$$c1c8beef.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
at com.myApp.service.system.client.ProcessAuditClient$$EnhancerByCGLIB$$4bf3274e_2.processAllSitesAudits(<generated>)
at com.myApp.service.quartz.AuditQuartzJob.executeInternal(AuditQuartzJob.java:30)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:66)
at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
Caused by: java.sql.BatchUpdateException: Data truncation: Data too long for column 'title' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2204)
... 33 more
14:53:57,609 ERROR QuartzScheduler_Worker-4 com.myApp.service.impl.GoldWordAuditService - Gold word audit failed.
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not update: [com.myApp.model.ProcessAudit#3363]; uncategorized SQLException for SQL [update ... set ...]; SQL state [01004]; error code [0]; Data truncation: Data too long for column 'title' at row 1; nested exception is java.sql.BatchUpdateException: Data truncation: Data too long for column 'title' at row 1
java.sql.BatchUpdateException: Data truncation: Data too long for column 'title' at row 1
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:647)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:34)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2204)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:951)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:109)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:819)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:817)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:813)
at com.myApp.dao.hibernate.PageDAOHibernate.getSitePages(PageDAOHibernate.java:14)
at com.myApp.service.impl.GoldWordAuditService.createMapOfPages(GoldWordAuditService.java:183)
at com.myApp.service.impl.GoldWordAuditService.executeAudit(GoldWordAuditService.java:383)
at com.myApp.service.system.client.ProcessAuditClient.executeAudits(ProcessAuditClient.java:309)
at com.myApp.service.system.client.ProcessAuditClient.processAllSitesAudits(ProcessAuditClient.java:154)
at com.myApp.service.system.client.ProcessAuditClient$$FastClassByCGLIB$$c1c8beef.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
at com.myApp.service.system.client.ProcessAuditClient$$EnhancerByCGLIB$$4bf3274e_2.processAllSitesAudits(<generated>)
at com.myApp.service.quartz.AuditQuartzJob.executeInternal(AuditQuartzJob.java:30)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:66)
at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)
14:53:57,609 INFO QuartzScheduler_Worker-4 com.myApp.service.system.client.ProcessAuditClient - ***End time for this audit: Mon Nov 13 14:53:57 PST 2006
14:53:57,609 INFO QuartzScheduler_Worker-4 com.myApp.service.system.client.ProcessAuditClient - QuartzScheduler_Worker-4.com.myApp.service.system.client.ProcessAuditClient.HRJ-LOG=> Finished method: processAllSitesAudits()
14:53:57,640 ERROR QuartzScheduler_Worker-4 org.hibernate.jdbc.AbstractBatcher - Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:93)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:79)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:195)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:171)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2163)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:980)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:394)
at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:643)
at com.myApp.service.system.client.ProcessAuditClient$$EnhancerByCGLIB$$4bf3274e_2.processAllSitesAudits(<generated>)
at com.myApp.service.quartz.AuditQuartzJob.executeInternal(AuditQuartzJob.java:30)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:66)
at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)

[/b]

[b]Name and version of the database you are using:MySQL 5.0[/b]


Hello all.

I have problems with hibernate session.
I must handle in a process every database exception and continue with that process, but when a GenericJDBCException occurs (it try to insert a string with more than 255 chars in a varchar(255) db column) , the hibernate session seems to become corrupted because it does't work anymore, it throws a StaleStateException exception anytime that any synchronization is made.
This is a known issue?
What happens with the session after the GenericJDBCException exception?

anybody could help me with this problem?

NOTE: the method wich triggers the exception has a hibernate session available via a HibernateInterceptor configured for the bean with FLUSH_ALWAYS.

Another question: I want to handle any db exception but when I use HibernateInterceptor the synchronization is made out of the process (in HibernateAccesor.flushIfNeeded()), How can I handle the db exceptions in that case?

thanks to all!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 7:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
The hibernate session should be thrown away when any exception occurs. It can be left in a inconsistent state relative to the database. This is not the case with a read only session since it does not employ any session level caching. Alternatively, you could clear the session level cache when an exception occurs (but I don't personnally like this approach as it is not a clean solution and it can result in future issues and problems).


Top
 Profile  
 
 Post subject: hibernate session
PostPosted: Mon Nov 13, 2006 8:04 pm 
Newbie

Joined: Mon Aug 07, 2006 7:14 pm
Posts: 16
thanks david for your quick answer...

... and what do you recommend me if I want to handle any db exception using HibernateInterceptor (when the synchronization is made out of the process in HibernateAccesor.flushIfNeeded())
How can I handle the db exceptions in that case?

thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.