Hi Brian, I noticed your mailing list message came through moderation. This means that you won't be getting replies via email (unless you are subscribed with another address). Make sure you check the archives - there are some replies already: https://lists.apache.org/thread.html/Zozc0naffk51vnc
Andrus > On May 19, 2016, at 7:22 PM, Brian Baillargeon <[email protected]> wrote: > > Hey folks, > > Generally, I retrieve objects using > BaseContext.getThreadObjectContext().performQuery(query); > and after creating / updating / deleting objects, I commit changes with > BaseContext.getThreadObjectContext().commitChanges(); > > This commits all changes on the current thread's ObjectContext, but is > there any way to specify which individual objects you want to commit > changes for? I'm just looking for a best practice to safeguard my > objects, but I think this would be a valid use case: > You have a table that logs exceptions, and you encounter an exception > while modifying an object backed by another table. So you want to > persist the exception's log, but not the object you were modifying. > > I've thought about separating my objects onto different ObjectContexts > (Ie. children of getThreadObjectContext()), but this doesn't seem like a > good solution, especially if you have relationships (since related > objects have to be in the same ObjectContext). > > Any suggestions? I'm using Cayenne 3.0.2, but I'm all ears for 3.1 > suggestions too. > > Thanks, > Brian Baillargeon >
