user3528733
user3528733

Reputation: 1299

JPA Multiple commit within one transaction

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

Answers (1)

nuno
nuno

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

Related Questions