Dealing with a commit exception....

Tony Giaccone <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <CALQ75kGC_S1wk_PedjK7suW0Zc2gp8KqfPvDaY=1UaYaLTxazQ@mail.gmail.com>
I have a list of 10 new objects that I've inserted into the objectcontex
and am about to do a commit changes on the object context.

One, or more, of those entries violates a constraint and causes the commit
changes to throw an exception.

Now most of them are  probably ok, so I want to make sure they get
inserted. How do I handle this?

My first thought was to invalidate the 10 items.. then individually add
each one back into the context and do a commit changes after each add.  Is
that a reasonable path? Obviously the one that failed before will fail
again, and then I can just log that, invalidate it again and keep going.

Is there a better faster way to do this?



Tony Giaccone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.