Hi,
I'm using Hibernate together with ZK.
I get this error message (not valid without active transaction)
I'm doing 2 different ZK events, each running an own java thread, having a session and having non equal transactions.
I use HibernateSessionContextListener, as proposed in Small Talks - Hibernate + ZK.
in hibernate cfg file I use...
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.current_session_context_class">thread</property>
First I do...
// Start Hibernate
SessionFactory sf = HibernateUtil.getSessionFactory(connectionInfo.getXDB_ConnectionInfo());
Session session = sf.getCurrentSession();
Transaction ta = session.beginTransaction();
After beginning a transaction...
I do a lot of
findAll, findById, do some processing of the database objects and write these to an XML structure for output...
and at last I do
ta.commit();
Now, if I call this sequence in ZK twice, both have an active transaction at first. But then I get this Hibernate exception, that the first started transaction is not active :-(
I don't know, how this transaction vanishes, I don't get any log message about this.
What am I doing wrong? Or is there something not possible with Hibernate built in TransactionFactory ...
Do I need a JTA Manager together with Apache Tomcat...
Lots of questions, few answers ...
best regards,
martin
|