A common reason to use external tx is when you want atomic behavior
across multiple sources of DB modification (say Cayenne and raw JDBC)
or mixing Cayenne with other non-JDBC transactional resources (JMS
for instance). If you only modify the DB via Cayenne, then you don't
need external tx.
Just a heads-up: That is not the normal case in corporate processing; there are always other sources of database updates: Nightly batch processing, manual intervention through interactive SQL, or third-party software that's interacting with your storage. You'd have to thread it all through the Java service, which isn't always feasible or even desirable.across multiple sources of DB modification (say Cayenne and raw JDBC)
or mixing Cayenne with other non-JDBC transactional resources (JMS
for instance). If you only modify the DB via Cayenne, then you don't
need external tx.
Besides, if you don't have multiple sources of DB modification, you usually don't need a DB. Not an SQL-enabled one anyway.
you check out a local copy of your objects, you modify them, and then
commit. Only the last step involves a transaction and Cayenne can
handle starting and ending it internally with no user involvement.
What happens if a record is written that was modified by some third party?commit. Only the last step involves a transaction and Cayenne can
handle starting and ending it internally with no user involvement.
Ideally, Cayenne would avoid writing the udpates and instead report back that the application was trying to write stale data.