Of course there are multiple sources of DB modification. The question is - do they all have to be in the same transaction ;)
On Feb 21, 2012, at 12:33 PM, Durchholz, Joachim wrote: > This just made me wonder... > >> 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. > 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? > Ideally, Cayenne would avoid writing the udpates and instead report back that > the application was trying to write stale data. >
