Reputation: 1299
Can I have multiple commits within one JPA transaction ? I'm using JPA with Hibernate. Correct me if I'm wrong but commit won't end the transaction ? Thanks for replay.
Upvotes: 2
Views: 3559
Reputation: 1791
A transaction is a context created within the execution environment that groups multiple commits (and/or DML operations on a database) in one execution unit - if one goes wrong, all the work done in this transaction context is discarded.
So in short: you can have multiple operations in one transaction, only when you commit that transaction those changes are applied to database.
Upvotes: 4