persistence@glassfish.java.net

Re: Current fix on Issue 554 - incorrect value of EntityManager.contains() in non-tx case after query execution

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Thu, 13 Apr 2006 09:24:54 -0400

Wonseok Kim wrote:

> Oh, the issue subject refers to IllegalStateException instead of
> IllegalArgumentException!
> IllegalStateException is never thrown in non-tx, right?

Right. It's IllegalArgumentException.

>
>
> On 4/12/06, * Kenneth Saks* <Kenneth.Saks_at_sun.com
> <mailto:Kenneth.Saks_at_sun.com>> wrote:
>
> Wonseok Kim wrote:
>
> > Hi, persistence guys...
> >
> > Today I saw the fix for issue#554 - incorrect value of
> > EntityManager.contains() in non-tx case after query execution.
> >
> > It is fixed to return always false in non-tx, but then it could not
> > throw IllegalArgumentException when the argument is not entity.
> > Before determining whether entity managed or not, I think it should
> > check if the argument is valid entity.
> >
> > I guess there are two solutions,
> > 1. first check by delegate.contains(entity) and return false always.
>
> Good catch Wonseok. Thanks.
>
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=569
> <https://glassfish.dev.java.net/issues/show_bug.cgi?id=569>
>
> --ken
>
> >
> > 2. always detach entities by query result, then
> > delegate.contains(entity) will be enough.
> >
> > 2 is related to the issue#552 - improve management of non-tx entity
> > managers within entity manager wrapper.
> >
> > Thoughts?
> >
>
>
>