| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| How to cascade updateOverview Enabling cascading update Scenarios db.update() Limitations See also OverviewWhen working with long transactions, you can cascade the db.update() operation, so that, for example, updating the root of a large object graph causes all connected entites to update as well (provided cascading update is enabled on the particular relationships, of course). Enabling cascading updateTo enable cascading update on a relationship you simply set the cascading attribute of the <sql> field describing the relation to "update" (or "all"):
In case of bidirectional relationships, be aware that it matters on which end you enable cascading update. It is also possible to enable it on both ends. Scenarios
db.update()Let's say we have the objects Author and Book and they are in a one-to-one relationship, with every Book having exactly one Author. The database looks like this:
Now let's change the book's title. Note that we never directly load the book and that the change happens outside of any transaction:
Afterwards, the database looks like this:
Limitations
See also
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||