entityManager.getTransaction().rollback() detaches entities?

后端 未结 2 797
借酒劲吻你
借酒劲吻你 2021-01-21 06:38

I have the following piece of code:

EntityManagerFactory emf = Persistence.createEntityManagerFactory(\"test\")
EntityManager entityManager = emf.createEntityMan         


        
2条回答
  •  忘掉有多难
    2021-01-21 07:16

    In a PersistenceContext of "Transaction" then commit/rollback will detach objects used in the transaction. In PersistenceContext of "Extended" then commit/rollback do nothing like that, and objects are detached at close of the EM. Depends on your context

提交回复
热议问题