About Question enthuware.oce-jpad.v6.2.514 :
Posted: Sat Sep 22, 2018 5:19 pm
For some unknown reason this (in particular the line at //1) doesn't throw EntityAlreadyExistsException:
Code: Select all
public static void main(String[] args) {
setupY1();
setupY1A();
closeEM();
}
private static void setupY1() {
Y y1= new Y("foo");
em.getTransaction().begin();
em.persist(y1);
em.getTransaction().commit();
}
private static void setupY1A() {
em.getTransaction().begin();
Y y1 = em.find(Y.class, 1);
em.persist(y1); //1
em.getTransaction().commit();
}