cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Baillargeon <>
Subject Committing changes for specified individual objects
Date Thu, 19 May 2016 16:22:25 GMT
Hey folks,

Generally, I retrieve objects using
and after creating / updating / deleting objects, I commit changes with

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.

Brian Baillargeon

View raw message