org.springframework.orm.hibernate4.HibernateJdbcException

JDBC exception on Hibernate data access: SQLException for SQL [INSERT INTO fc_p_faclntlms1aoqglwzza0a_20161001 (time_period, prediction_count, footfall_count, unique_footfall_count, time_spent, fence_category_id, property_code, created) VALUES ('1900','2','2','2','60','19','FAPORYLMS1AOMXHHD3K4B',now()) ON DUPLICATE KEY UPDATE prediction_count=prediction_count+2, footfall_count=footfall_count+2,unique_footfall_count=unique_footfall_count+2,time_spent=time_spent+60;]; SQL state [null]; error code [0]; could not prepare statement; nested exception is org.hibernate.exception.GenericJDBCException: could not prepare statement

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web24

  • via Stack Overflow by Vishesh
    ,
  • Stack trace

    • org.springframework.orm.hibernate4.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [INSERT INTO fc_p_faclntlms1aoqglwzza0a_20161001 (time_period, prediction_count, footfall_count, unique_footfall_count, time_spent, fence_category_id, property_code, created) VALUES ('1900','2','2','2','60','19','FAPORYLMS1AOMXHHD3K4B',now()) ON DUPLICATE KEY UPDATE prediction_count=prediction_count+2, footfall_count=footfall_count+2,unique_footfall_count=unique_footfall_count+2,time_spent=time_spent+60;]; SQL state [null]; error code [0]; could not prepare statement; nested exception is org.hibernate.exception.GenericJDBCException: could not prepare statement at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:170) at org.springframework.orm.hibernate4.HibernateExceptionTranslator.convertHibernateAccessException(HibernateExceptionTranslator.java:57) at org.springframework.orm.hibernate4.HibernateExceptionTranslator.translateExceptionIfPossible(HibernateExceptionTranslator.java:44) at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59) at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at com.focus.cas.service.aspect.CASAspectHandler.logMethodExecutionTime(CASAspectHandler.java:122) at com.focus.cas.service.aspect.CASAspectHandler.profile(CASAspectHandler.java:43) at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) at com.focus.cas.dbaccess.mysql.flush.impl.DailyFlushDaoImpl$$EnhancerBySpringCGLIB$$1a5b5f55.updateFenceCategoryProperty(<generated>) at com.focus.cas.service.flush.impl.FlushServiceImpl.updateDBFromMap(FlushServiceImpl.java:1314) at com.focus.cas.service.flush.impl.FlushServiceImpl$$FastClassBySpringCGLIB$$d877b180.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:267) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) at com.focus.cas.service.flush.impl.FlushServiceImpl$$EnhancerBySpringCGLIB$$f652020f.updateDBFromMap(<generated>) at com.focus.cas.service.flush.impl.FlushServiceImpl.flush(FlushServiceImpl.java:1046) at com.focus.cas.service.flush.impl.FlushServiceImpl.access$100(FlushServiceImpl.java:107) at com.focus.cas.service.flush.impl.FlushServiceImpl$FlushThread.run(FlushServiceImpl.java:1534) at java.lang.Thread.run(Thread.java:745) Caused by: org.hibernate.exception.GenericJDBCException: could not prepare statement at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:196) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:96) at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:205) at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1310) at org.hibernate.internal.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:389) at com.focus.cas.dbaccess.mysql.flush.impl.DailyFlushDaoImpl.updateFenceCategoryProperty(DailyFlushDaoImpl.java:269) at com.focus.cas.dbaccess.mysql.flush.impl.DailyFlushDaoImpl$$FastClassBySpringCGLIB$$f7b6a91f.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ... 30 more Caused by: java.sql.SQLException: Connection has already been closed. at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:117) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80) at com.sun.proxy.$Proxy33.prepareStatement(Unknown Source) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$1.doPrepare(StatementPreparerImpl.java:103) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186) ... 40 more

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    mauritiusmauritius
    Once,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    15 more bugmates