org.hibernate.HibernateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • No bean named ... is defined - Spring Forum
    via by Unknown author,
  • An issue was recently noticed while using the HikariCP connection pool that is related to this SO article: http://stackoverflow.com/questions/20775165/how-does-hikaricp-handle-incomplete-jdbc-transactions/20776035#20776035 Using DBCP when a connection was returned commit was called before the connection was returned to the pool. Since HikariCP does not do this and when used in conjunction with springs transaction advising inside threads some strange issues can happen. Most notably is that transactions are not completed (aka committed) and are then rollbacked according to HikariCP (UPDATE: HikariCP 1.2.2 and above perform an automatic "rollback" for closed connections with auto-commit set to 'false'.) When auto-commit is on this is a non-issue. Onto Threads and Spring's HibernateTemplate, while in a Runnable and calling getHibernateTemplate things appear to work normally until you notice that the table has no data but the auto increment has been incremented as though there should be data. The transaction manager is not able to finish the transaction with a commit since there is no Hibernate session bound to the thread. This where the spring strangeness occurs becuase everything tends to work ok except for the transaction manager calling commit and if you try to get the getSessionFactory().getCurrentSession() this will fail with: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:544) This is due to the current thread does not have a context containing the Hibernate session. In this case we open a new session and bind it to the thread. PRO's This approach puts all the transaction management in one location and no changes are required to existing methods using the HibernateTemplate. CON's You need to manage the transaction explicitly, you could probably add a TransactionDefinition and not have to manage the details but you would still need to construct it here and bind it to the thread. If there are a lot of places in Sakai that use Threads and Springs HibernateTemplate it probably makes sense to create a Thread Executor Service that properly binds the HibernateDaoSupport to the Thread. I did look in Spring for any similar patterns and could not find one, as it would be nice if they had this kind of support for threads.
    via by Earle R Nietzel,
    • org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:544) at ru.runa.wfe.commons.ApplicationContextFactory.getCurrentSession(ApplicationContextFactory.java:75) at ru.runa.wfe.user.cache.ExecutorCacheImpl.getAll(ExecutorCacheImpl.java:297) at ru.runa.wfe.user.cache.ExecutorCacheImpl.getAllExecutors(ExecutorCacheImpl.java:307) at ru.runa.wfe.user.cache.ExecutorCacheImpl.<init>(ExecutorCacheImpl.java:75) at ru.runa.wfe.user.cache.ExecutorCacheCtrl.buildCache(ExecutorCacheCtrl.java:50) at ru.runa.wfe.user.cache.ExecutorCacheCtrl.buildCache(ExecutorCacheCtrl.java:36) at ru.runa.wfe.commons.cache.CachingLogic.getCacheImpl(CachingLogic.java:225) at ru.runa.wfe.user.cache.ExecutorCacheCtrl.getActor(ExecutorCacheCtrl.java:110) at ru.runa.wfe.user.dao.ExecutorDAO.getExecutorsFromCache(ExecutorDAO.java:806) at ru.runa.wfe.user.dao.ExecutorDAO.getExecutors(ExecutorDAO.java:762) at ru.runa.wfe.user.dao.ExecutorDAO.getActorsByCodes(ExecutorDAO.java:252) at ru.runa.wfe.extension.orgfunction.GetActorsOrgFunctionBase.getExecutors(GetActorsOrgFunctionBase.java:38) at ru.runa.wfe.extension.orgfunction.OrgFunctionHelper.evaluateOrgFunction(OrgFunctionHelper.java:83) at ru.runa.wf.logic.bot.UpdatePermissionsTaskHandler.evaluateOrgFunctions(UpdatePermissionsTaskHandler.java:82) at ru.runa.wf.logic.bot.UpdatePermissionsTaskHandler.handle(UpdatePermissionsTaskHandler.java:65) at ru.runa.wf.logic.bot.WorkflowBotTaskExecutor.doHandle(WorkflowBotTaskExecutor.java:153) at ru.runa.wf.logic.bot.WorkflowBotTaskExecutor.run(WorkflowBotTaskExecutor.java:187) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

    Users with the same issue

    odd
    1 times, last one,
    mortalman7
    3 times, last one,
    Unknown visitor2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    1 more bugmates