persistence@glassfish.java.net

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

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Wed, 12 Apr 2006 10:27:19 -0400

Hello,

    Based on the specification once the query is complete the EM should be cleared but this would require proxying queries as well. 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?