db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject saving the state of a object collection
Date Fri, 28 Mar 2008 15:23:04 GMT

Has anybody found a simple way to  save the state of object collections ?
To illustrate what I mean, here's an example (I'm using complexObjectModel
= true and objectIsCaching = true):

I have two tables, Book and Author. A foreign key exists from book to
Author, so an author can have several books associated.
Now I load one author including the associated books. I modify the
associated set (i.e modify, add and delete books) and want to save it as it
is (i.e. after saving, the list of associated books in the database should
be exactly equal to the list of books in the author object).

The algorithm I can come up with is the following:
1) select the ids of all books in the author object which are not new in a
2) delete all books for the author which have an id not in the above
collection of ids
3) save the author (this will save the underlying books as well)

2) is painful if the book table has a composite primary key (as I cannot
see how Criteria.NOT_IN should work in this case (or does It ? please tell
Does anybody see an easier way to do this ? Hitting the database during
modifying the book list is not an option in my case because the possibility
to NOT save the changes should exist after making the changes in the GUI


To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message