org.hibernate.HibernateException: saveOrUpdate is not valid without active transaction
We are using the code from https://github.com/codahale/dropwizard/tree/master/dropwizard-example
Our test looks like this. We hoped the Transactional annotation would work.
@Test
@Transactional
public void testCreate()
{
this.person = new Person();
this.person.setFullName("John Smith");
this.person.setJobTitle("Operations");
Person newPerson = null;
try {
newPerson = this.personDAO.create(this.person);
} catch (Exception e) {
e.printStackTrace();
}
assertNotNull(newPerson);