[
https://issues.apache.org/jira/browse/OPENJPA-2523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14091677#comment-14091677
]
brian yoder commented on OPENJPA-2523:
--------------------------------------
Some more information that may be helpful:
It seems that the call to "JPAFacadeHelper.toOpenJPAObjectId" is returning an
ObjectId type, but the value in the cache is stored as IntId. So when I
construct the key myself (using IntId) it bypasses the
JPAFacadeHelper.toOpenJPAObjectId function, as in the first lines it just lets
it pass through. So the question is why are you trying to remove a different
key then the one that was put into the cache?
// This is the type & value which was returned from the call to
"JPAFacadeHelper.toOpenJPAObjectId"
2014-08-08T23:31:03.125-0700|Info: org.apache.openjpa.util.ObjectId
VALUE=EntityName-1495201
// This is the type & value which seems to be used in the DataStore cache
(actual key after debugging)
2014-08-08T23:31:03.125-0700|Info: org.apache.openjpa.util.IntId VALUE=1495201
> evict by OID is broken
> ----------------------
>
> Key: OPENJPA-2523
> URL: https://issues.apache.org/jira/browse/OPENJPA-2523
> Project: OpenJPA
> Issue Type: Bug
> Environment: JPA 2.3.0
> Reporter: brian yoder
>
> I cannot seem to get the evict by OID working. When I use evict by class
> that works, but what I really want to do is to just evict a single entity.
> Here is my scenario:
> 1) Bean managed EJB uses a native SQL to modify an Entity. This does begin &
> commit.
> 2) After the commit it makes a call to another EJB, but that call is
> returning stale data.
> I have tried:
> OpenJPAEntityManager kem = OpenJPAPersistence.cast(em);
> kem.getEntityManagerFactory().getCache().evict(X.class, id);
> But that doesn't work, but this works:
> OpenJPAEntityManager kem = OpenJPAPersistence.cast(em);
> kem.getEntityManagerFactory().getCache().evictAll(X.class);
> Am I the only one having issues with evict by ID?
--
This message was sent by Atlassian JIRA
(v6.2#6252)