JPA transaction/rollback behaviour with objects persisted via cascade

前端 未结 1 1484
轻奢々
轻奢々 2020-12-21 01:17

I have two objects Antrag (application) and Anlage (facility). An application can be made for multiple facilities. The application is persisted directly in the DAO. The faci

相关标签:
1条回答
  • 2020-12-21 02:02

    Your expectation is correct: everything should be made in a single transaction, and the insertion of Antrag should be rolled back as well.

    I think your persistence-unit is simply not JTA: test in the persistence.xml file that you have something like:

    <persistence-unit name="ejb-model" transaction-type="JTA">
    <jta-data-source>java:/someNameDB</jta-data-source>
    
    0 讨论(0)
提交回复
热议问题