Hello guys
I have a problem with hibernate/spring and akka. I have a regular spring application with service/dao layers configured for transaction. Everything works fine, but not with akka.
Because my actors are not spring beans, I manually set the dependancy for the DAO (this works) but I get the following exception when I try to use the hibernate session:
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:700)
...
The faulty line is:
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(persistentClass);
where session factory is a spring bean for hibernate session.
Again, everything works fine as long as I stay in the spring world.
The exception is thrown from a thread created by akka (something like testSystem-akka.actor.default-dispatcher-1). Is there a workaround for that ?
I found that using HibernateTemplate solve this, but I didn't test it extensively. The solution with hibernate session has been used for a long time so I really want to continue using it.
Thanks
Greg