package org.hibernate;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* HHH-8996.
*
*/
public class HHH_8996 {
private EntityManagerFactory entityManagerFactory;
private EntityTransaction transaction;
private EntityManager manager;
@Before
public void before() throws Exception {
entityManagerFactory = createSessionFactory();
manager = entityManagerFactory.createEntityManager();
transaction = manager.getTransaction();
}
private EntityManagerFactory createSessionFactory() throws Exception {
return Persistence.createEntityManagerFactory("org.hibernate.tutorial.jpa");
}
@Test
public void test() {
transaction.begin();
Assert.assertFalse(transaction.getRollbackOnly());
try {
manager.createNamedQuery("NOT_THERE");
} catch (IllegalArgumentException e) {
}
Assert.assertFalse(transaction.getRollbackOnly());
}
}