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: Wed, 12 Apr 2006 10:22:42 -0400

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

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