Hi,
The following code is from JPWH page, 423:
The following is a statement regarding this code given on the same page:
In the first transaction, you retrieve an Item object. The transaction then completes, but the item is still in persistent state. Hence, in the second transaction, you not only load a User object, but also update the modified persistent item when the second transaction is committed (in addition to an update for the dirty user instance).
My doubt is if Item is being updated upon the next commit anyway, what is the difference between modifying a persistent entity within a transaction and outside a transaction? In other words what is the difference between the following two codes -
and
Please help me understand this.
thank you!