openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Awe <jeff1...@gmail.com>
Subject Re: Query not getting evicted from QueryCache
Date Wed, 04 Nov 2009 04:23:24 GMT
Catalina,

1.  This is how I enabled DataCache and QueryCache:
            <property name="openjpa.QueryCache" value="true"/>
            <property name="openjpa.DataCache" value="true"/>
2.  The same application that updates RelationshipInfo also issues the
query.
3.  This is how the Query is created:

Query query = entityManager.createQuery(queryStmt);

Here is the stacktrace:

org.apache.openjpa.kernel.QueryImpl.<init>(org.apache.openjpa.kernel.Broker,
java.lang.String, org.apache.openjpa.kernel.StoreQuery) line: 132
org.apache.openjpa.kernel.FinalizingBrokerImpl(org.apache.openjpa.kernel.BrokerImpl).newQueryImpl(java.lang.String,
org.apache.openjpa.kernel.StoreQuery) line: 3519
org.apache.openjpa.kernel.FinalizingBrokerImpl(org.apache.openjpa.kernel.BrokerImpl).newQuery(java.lang.String,
java.lang.Object) line: 3496
org.apache.openjpa.kernel.DelegatingBroker.newQuery(java.lang.String,
java.lang.Object) line: 1225
org.apache.openjpa.persistence.EntityManagerImpl.createQuery(java.lang.String,
java.lang.String) line: 870
org.apache.openjpa.persistence.EntityManagerImpl.createQuery(java.lang.String)
line: 865
org.apache.openjpa.persistence.EntityManagerImpl.createQuery(java.lang.String)
line: 1

queryStmt =
"SELECT distinct
OPERATINGSYSTEM1.OID,OPERATINGSYSTEM1.Guid,OPERATINGSYSTEM1.ObjectType,OPERATINGSYSTEM1.Name,REMOTESERVICEACCESSPOINT1.OID,REMOTESERVICEACCESSPOINT1.Guid,REMOTESERVICEACCESSPOINT1.ObjectType,REMOTESERVICEACCESSPOINT1.Name
FROM OperatingSystem
OPERATINGSYSTEM1,System_accessedVia_RemoteServiceAccessPoint
SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1,RemoteServiceAccessPoint
REMOTESERVICEACCESSPOINT1,RelationshipInfo RELATIONSHIPINFO1 WHERE
OPERATINGSYSTEM1.OID = SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.sourceId
AND REMOTESERVICEACCESSPOINT1.OID =
SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.targetId AND
(OPERATINGSYSTEM1.Guid = ?1) AND (OPERATINGSYSTEM1.OID = ?2) AND
((OPERATINGSYSTEM1.BuildNumber = ?3)) AND (REMOTESERVICEACCESSPOINT1.Guid =
?4) AND (REMOTESERVICEACCESSPOINT1.OID = ?5) AND
((REMOTESERVICEACCESSPOINT1.Port = ?6)) AND RELATIONSHIPINFO1.changedDate >
?7 and RELATIONSHIPINFO1.sourceOID=OPERATINGSYSTEM1.OID and
RELATIONSHIPINFO1.relationshipType = ?8 and
RELATIONSHIPINFO1.targetOID=REMOTESERVICEACCESSPOINT1.OID"

Then parameters are set on the Query after it is created.

Thanks,

Jeff

On Mon, Nov 2, 2009 at 2:01 PM, catalina wei <catalina.wei@gmail.com> wrote:

> Jeff,
> Could you provide more info :
> 1. in persistence.xml, show us how you enable DataCache and QueryCache.
> 2. the updates to RelationshipInfo, is that done by the same application
> that issued the query ? or some other application ?
> 3. Could you show the code fragment that issues em.createQuery ?
>
> Thanks.
> Catalina
>
> On Mon, Nov 2, 2009 at 10:15 AM, Jeff Awe <jeff1awe@gmail.com> wrote:
>
> > I'm running on OpenJPA 1.2.1
> >
> > The following query is added to the QueryCache:
> >
> > Query: org.apache.openjpa.kernel.QueryImpl@3afe3afe;
> > candidate class: class com.ibm.usmi.datamodel.system.OperatingSystem;
> > query: SELECT distinct
> >
> >
> OPERATINGSYSTEM1.OID,OPERATINGSYSTEM1.Guid,OPERATINGSYSTEM1.ObjectType,OPERATINGSYSTEM1.Name,REMOTESERVICEACCESSPOINT1.OID,REMOTESERVICEACCESSPOINT1.Guid,REMOTESERVICEACCESSPOINT1.ObjectType,REMOTESERVICEACCESSPOINT1.Name
> > FROM OperatingSystem
> > OPERATINGSYSTEM1,System_accessedVia_RemoteServiceAccessPoint
> > SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1,RemoteServiceAccessPoint
> > REMOTESERVICEACCESSPOINT1,RelationshipInfo RELATIONSHIPINFO1 WHERE
> > OPERATINGSYSTEM1.OID =
> > SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.sourceId
> > AND REMOTESERVICEACCESSPOINT1.OID =
> > SYSTEM_ACCESSEDVIA_REMOTESERVICEACCESSPOINT1.targetId AND
> > (OPERATINGSYSTEM1.Guid = ?1) AND (OPERATINGSYSTEM1.OID = ?2) AND
> > ((OPERATINGSYSTEM1.BuildNumber = ?3)) AND (REMOTESERVICEACCESSPOINT1.Guid
> =
> > ?4) AND (REMOTESERVICEACCESSPOINT1.OID = ?5) AND
> > ((REMOTESERVICEACCESSPOINT1.Port = ?6)) AND RELATIONSHIPINFO1.changedDate
> >
> > ?7 and RELATIONSHIPINFO1.sourceOID=OPERATINGSYSTEM1.OID and
> > RELATIONSHIPINFO1.relationshipType = ?8 and
> > RELATIONSHIPINFO1.targetOID=REMOTESERVICEACCESSPOINT1.OID
> >
> > Later on, a record in RelationshipInfo is changed, which changes what
> > should
> > be returned from this query.  I'd expect this to cause the cached query
> to
> > get evicted from the QueryCache, but it is not.  If I get the
> > QueryResultCache, and evictAll RelationshipInfo.class, it still doesn't
> get
> > removed.  This seems to be because the AccessPath only contains
> > OperatingSystem.  I'd expect this to contain all entities that this query
> > deals with:
> >                 {OperatingSystem,
> > System_accessedVia_RemoteServiceAccessPoint, RemoteServiceAccessPoint,
> > RelationshipInfo}
> > But the AccessPath only seems to contain the entity of what is returned
> > from
> > the query.
> >
> > What do I need to do so this query gets evicted like I'd expect.
> >
> > Thanks - Jeff
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message