I think it would be better to figure out the "problem" objects before
committing by querying the DB and the object context.

On Wed, Jun 23, 2021 at 9:47 AM Tony Giaccone <t...@giaccone.org> wrote:

> 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
>

Reply via email to