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:35:56 -0400

Gordon Yorke wrote:

> Hello,
>
> Based on the specification once the query is complete the EM
> should be cleared but this would require proxying queries as well.
>
Yup, our plan is to proxy the query.

> Alternatively the non-tx EM could be cleared before any call then
> simply deferring contains to the Persistence Provider would be
> enough. The issue of two queries returning the same instances would
> still occur though.
>
> --Gordon
>
>
>
> -----Original Message-----
> *From:* Wonseok Kim [mailto:guruwons_at_gmail.com]
> *Sent:* Tuesday, April 11, 2006 11:11 PM
> *To:* persistence_at_glassfish.dev.java.net
> *Subject:* Current fix on Issue 554 - incorrect value of
> EntityManager.contains() in non-tx case after query execution
>
> 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.
> 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?
>