Hello,
i am working on a Projekt using EJB 2.1 and Hibernate. I got lots of DAO using CMT together with SessionFactory.getCurrentSession()
But when i want to run my JUNIT Test Cases for the DAOs, i got an exception:
Code:
org.hibernate.HibernateException: createQuery is not valid without active transaction
To solve the Problem, i can change the code in the daos by using
Code:
session.beginTransaction
but i dont like to have this in my daos cause i want to use CMT.
Another way is to write a 2nd dao only for JUNIT..... also bad.
So any idea how to run JUNIT-Tests of CMT-DAOs without changing code?