ํ๊ฒฝ
โข
OneToMany ๋จ๋ฐฉํฅ
โข
cascade persist
โข
orphan removal = true
entityManager.getTransaction().begin();
entityManager.persist(morak);
entityManager.flush();
entityManager.getTransaction().commit();
EntityManager entityManager2 = entityManagerFactory.createEntityManager();
entityManager2.getTransaction().begin();
morak.removeMember(0);
entityManager2.flush();
entityManager2.getTransaction().commit();
entityManager.persist(eden);
Java
๋ณต์ฌ
โ delete not working
entityManager2 ๊ด๋ จ ๋ชจ๋ ๊ฑท์ด๋ด๋ฉด
entityManager.getTransaction().begin();
entityManager.persist(morak);
entityManager.flush();
entityManager.getTransaction().commit();
// EntityManager entityManager2 = entityManagerFactory.createEntityManager();
// entityManager2.getTransaction().begin();
morak.removeMember(0);
// entityManager2.flush();
// entityManager2.getTransaction().commit();
// entityManager.persist(eden);
Markdown
๋ณต์ฌ
entityManager ์ commit ์ดํ์ด๋ค.