Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Cache hit

Tim,

I think this is the system property you are referring to

-Dorg.eclipse.persistence.querymonitor=true

-jason

On Fri, Jun 19, 2009 at 4:14 PM, Tim Hollosy<hollosyt@xxxxxxxxx> wrote:
> I'm too lazy to read this whole thread, but here's some cache tips:
>
> a generic find fresh method:
>
> public <T> T findFresh(Class<T> entityClass, Object primaryKey) {
>         T result =  getEntityManager().find(entityClass, primaryKey);
>         if(result == null)
>             return null;
>
>         getEntityManager().refresh(result);
>         return result;
>     }
>
> Fresh Query:
> public static void setNoCacheHints(Query q)
>    {
>        q.setHint(QueryHints.REFRESH, HintValues.TRUE);
>    }
>
>
> There also IS a system property you can set that will log cache hits
> and misses every few minutes  I can't remember what it is, and 15
> minutes of searching through gmail logs hasn't helped me, so hopefully
> someone on the list can chime in.
>
> ./tch
>
>
> On Fri, Jun 19, 2009 at 3:55 PM, khaskett <khaskett@xxxxxxxxxxx> wrote:
>>
>> I started using @Cache(alwaysRefresh=true) on my main Entity, this works
>> great locally.  But for some reason it is not working at the client site.
>> They are running Websphere 6.1 on iSeries.  Any idea on why this would
>> behave differently?  Is there a way to log if the request actually goes to
>> the DB or if it pulls it from the cache?
>>
>>
>> khaskett wrote:
>> >
>> > I moved the annotations from the getters to the fields and this has solved
>> > my problem with recursion, but now I seem to have a different issue.  When
>> > I update children entitites they do not get persisted.  This was working
>> > when I was not using the queryhint.
>> >
>> > Any ideas why this has changed its behavior?
>> >
>> >
>> > Christopher Delahunt wrote:
>> >>
>> >> I find it strange that the
>> >> CpTransaction.setCpTerrorismCoverage(CpTransCoverage) line: 2226
>> >> call causes a
>> >> CpTransCoverage.setCpTransaction(CpTransaction) line: 135
>> >>
>> >> Are you using the method to set back pointers?  If so, you shouldn't
>> >> have the JPA provider using method access, and instead annotate the
>> >> fields directly.
>> >>
>> >> Best Regards,
>> >> Chris
>> >>
>> >> Kevin Haskett wrote:
>> >>> I added them to my findById -
>> >>>
>> >>>     public CpTransaction findById(final Long id) {
>> >>>         EntityManager em = getEntityManager();
>> >>>         try {
>> >>>             final String queryString = "select model from CpTransaction
>> >>> model where model.transactionId = :propertyValue";
>> >>>             final Query query = em.createQuery(queryString);
>> >>>             query.setParameter("propertyValue", id);
>> >>>             return (CpTransaction) query.getSingleResult();
>> >>>         } catch (final RuntimeException re) {
>> >>>             throw re;
>> >>>         } finally {
>> >>>             em.close();
>> >>>         }
>> >>>     }
>> >>> First I tried adding this -
>> >>> query.setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache);
>> >>>
>> >>> Then I tried this -
>> >>> query.setHint(QueryHints.REFRESH, HintValues.TRUE);
>> >>>
>> >>> Which caused the looping scenario.
>> >>>
>> >>> -----Original Message-----
>> >>> From: eclipselink-users-bounces@xxxxxxxxxxx
>> >>> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
>> >>> Sent: Thursday, May 21, 2009 9:54 AM
>> >>> To: EclipseLink User Discussions
>> >>> Subject: Re: [eclipselink-users] Cache hit
>> >>>
>> >>> Which cache usage settings have you added to your model since your
>> >>> initial message on this tread?
>> >>>
>> >>> Kevin Haskett wrote:
>> >>>
>> >>>> Here is the update call -
>> >>>>     public CpTransaction update(final CpTransaction entity) throws
>> >>>> DataAccessException {
>> >>>>         CpTransaction newRef = null;
>> >>>>         EntityManager em = getEntityManager();
>> >>>>         newRef = em.merge(entity);
>> >>>>         return newRef;
>> >>>>     }
>> >>>>
>> >>>>
>> >>>> -----Original Message-----
>> >>>> From: eclipselink-users-bounces@xxxxxxxxxxx
>> >>>> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
>> >>>> Sent: Thursday, May 21, 2009 9:48 AM
>> >>>> To: EclipseLink User Discussions
>> >>>> Subject: Re: [eclipselink-users] Cache hit
>> >>>>
>> >>>> What does the code that runs this query look like?
>> >>>>
>> >>>> Kevin Haskett wrote:
>> >>>>
>> >>>>> Now that I have added that, when I do an update it is going into a
>> >>>>> looping condition.
>> >>>>>
>> >>>>> Here is part of the stack trace -
>> >>>>> CpTransCoverage._persistence_getcpTransaction() line: not available
>> >>>>> CpTransCoverage._persistence_setcpTransaction(CpTransaction) line:
>> >>>>>
>> >>> not
>> >>>
>> >>>>> available
>> >>>>> CpTransCoverage.setCpTransaction(CpTransaction) line: 135
>> >>>>> CpTransaction.setCpTerrorismCoverage(CpTransCoverage) line: 2226
>> >>>>> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> >>>>> available [native method]
>> >>>>> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 79
>> >>>>> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
>> >>>>> Method.invoke(Object, Object...) line: 618
>> >>>>> PrivilegedAccessHelper.invokeMethod(Method, Object, Object[]) line:
>> >>>>>
>> >>>> 344
>> >>>> WeavedObjectBasicIndirectionPolicy.setRealAttributeValueInObject(Objec
>> >>>> t,
>> >>>>
>> >>>>> Object) line: 125
>> >>>>>
>> >>>>>
>> >>>> OneToOneMapping(ForeignReferenceMapping).setRealAttributeValueInObject
>> >>>> (O
>> >>>>
>> >>>>> bject, Object) line: 1038
>> >>>>> OneToOneMapping(ObjectReferenceMapping).mergeIntoObject(Object,
>> >>>>>
>> >>>> boolean,
>> >>>>
>> >>>>> Object, MergeManager) line: 437
>> >>>>> ObjectBuilder.mergeIntoObject(Object, boolean, Object, MergeManager,
>> >>>>> boolean, boolean) line: 2578
>> >>>>> ObjectBuilder.mergeIntoObject(Object, boolean, Object, MergeManager)
>> >>>>> line: 2557
>> >>>>> MergeManager.mergeChangesOfOriginalIntoWorkingCopy(Object) line: 526
>> >>>>> MergeManager.mergeChanges(Object, ObjectChangeSet) line: 269
>> >>>>> RepeatableWriteUnitOfWork(UnitOfWorkImpl).revertObject(Object, int)
>> >>>>> line: 4355
>> >>>>> ReadObjectQuery(ObjectBuildingQuery).registerIndividualResult(Object,
>> >>>>> UnitOfWorkImpl, JoinedAttributeManager) line: 374
>> >>>>> ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuildingQuery,
>> >>>>> AbstractRecord, UnitOfWorkImpl, Vector, ClassDescriptor,
>> >>>>> JoinedAttributeManager) line: 582
>> >>>>> ObjectBuilder.buildObjectInUnitOfWork(ObjectBuildingQuery,
>> >>>>> JoinedAttributeManager, AbstractRecord, UnitOfWorkImpl, Vector,
>> >>>>> ClassDescriptor) line: 544
>> >>>>> ObjectBuilder.buildObject(ObjectBuildingQuery, AbstractRecord,
>> >>>>> JoinedAttributeManager) line: 485
>> >>>>> ObjectBuilder.buildObject(ObjectLevelReadQuery, AbstractRecord) line:
>> >>>>> 437
>> >>>>> ReadObjectQuery(ObjectLevelReadQuery).buildObject(AbstractRecord)
>> >>>>>
>> >>>> line:
>> >>>>
>> >>>>> 571
>> >>>>> ReadObjectQuery.registerResultInUnitOfWork(Object, UnitOfWorkImpl,
>> >>>>> AbstractRecord, boolean) line: 712
>> >>>>> ReadObjectQuery.executeObjectLevelReadQuery() line: 436
>> >>>>> ReadObjectQuery(ObjectLevelReadQuery).executeDatabaseQuery() line:
>> >>>>> 930
>> >>>>>
>> >>>>> ReadObjectQuery(DatabaseQuery).execute(AbstractSession,
>> >>>>>
>> >>>> AbstractRecord)
>> >>>>
>> >>>>> line: 664
>> >>>>> ReadObjectQuery(ObjectLevelReadQuery).execute(AbstractSession,
>> >>>>> AbstractRecord) line: 891
>> >>>>> ReadObjectQuery.execute(AbstractSession, AbstractRecord) line: 397
>> >>>>>
>> >>>>>
>> >>>> ReadObjectQuery(ObjectLevelReadQuery).executeInUnitOfWork(UnitOfWorkIm
>> >>>> pl
>> >>>>
>> >>>>> , AbstractRecord) line: 954
>> >>>>>
>> >>>>>
>> >>>> RepeatableWriteUnitOfWork(UnitOfWorkImpl).internalExecuteQuery(Databas
>> >>>> eQ
>> >>>>
>> >>>>> uery, AbstractRecord) line: 2697
>> >>>>>
>> >>>>>
>> >>> RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery,
>> >>>
>> >>>>> AbstractRecord, int) line: 1181
>> >>>>>
>> >>>>>
>> >>> RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery,
>> >>>
>> >>>>> AbstractRecord) line: 1165
>> >>>>> QueryBasedValueHolder.instantiate(AbstractSession) line: 77
>> >>>>> QueryBasedValueHolder.instantiate() line: 67
>> >>>>> QueryBasedValueHolder(DatabaseValueHolder).getValue() line: 83
>> >>>>> UnitOfWorkQueryValueHolder(UnitOfWorkValueHolder).instantiateImpl()
>> >>>>> line: 161
>> >>>>> UnitOfWorkQueryValueHolder(UnitOfWorkValueHolder).instantiate() line:
>> >>>>> 230
>> >>>>> UnitOfWorkQueryValueHolder(DatabaseValueHolder).getValue() line: 83
>> >>>>> CpTransCoverage._persistence_getcpTransaction() line: not available
>> >>>>> CpTransCoverage._persistence_setcpTransaction(CpTransaction) line:
>> >>>>>
>> >>> not
>> >>>
>> >>>>> available
>> >>>>> CpTransCoverage.setCpTransaction(CpTransaction) line: 135
>> >>>>> CpTransaction.setCpTerrorismCoverage(CpTransCoverage) line: 2226
>> >>>>> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> >>>>> available [native method]
>> >>>>> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 79
>> >>>>> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
>> >>>>> Method.invoke(Object, Object...) line: 618
>> >>>>> PrivilegedAccessHelper.invokeMethod(Method, Object, Object[]) line:
>> >>>>>
>> >>>> 344
>> >>>> WeavedObjectBasicIndirectionPolicy.setRealAttributeValueInObject(Objec
>> >>>> t,
>> >>>>
>> >>>>> Object) line: 125
>> >>>>>
>> >>>>>
>> >>>> OneToOneMapping(ForeignReferenceMapping).setRealAttributeValueInObject
>> >>>> (O
>> >>>>
>> >>>>> bject, Object) line: 1038
>> >>>>> OneToOneMapping(ObjectReferenceMapping).mergeIntoObject(Object,
>> >>>>>
>> >>>> boolean,
>> >>>>
>> >>>>> Object, MergeManager) line: 437
>> >>>>> ObjectBuilder.mergeIntoObject(Object, boolean, Object, MergeManager,
>> >>>>> boolean, boolean) line: 2578
>> >>>>> ObjectBuilder.mergeIntoObject(Object, boolean, Object, MergeManager)
>> >>>>> line: 2557
>> >>>>> MergeManager.mergeChangesOfOriginalIntoWorkingCopy(Object) line: 526
>> >>>>> MergeManager.mergeChanges(Object, ObjectChangeSet) line: 269
>> >>>>> RepeatableWriteUnitOfWork(UnitOfWorkImpl).revertObject(Object, int)
>> >>>>> line: 4355
>> >>>>> ReadObjectQuery(ObjectBuildingQuery).registerIndividualResult(Object,
>> >>>>> UnitOfWorkImpl, JoinedAttributeManager) line: 374
>> >>>>> ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuildingQuery,
>> >>>>> AbstractRecord, UnitOfWorkImpl, Vector, ClassDescriptor,
>> >>>>> JoinedAttributeManager) line: 582
>> >>>>> ObjectBuilder.buildObjectInUnitOfWork(ObjectBuildingQuery,
>> >>>>> JoinedAttributeManager, AbstractRecord, UnitOfWorkImpl, Vector,
>> >>>>> ClassDescriptor) line: 544
>> >>>>> ObjectBuilder.buildObject(ObjectBuildingQuery, AbstractRecord,
>> >>>>> JoinedAttributeManager) line: 485
>> >>>>> ObjectBuilder.buildObject(ObjectLevelReadQuery, AbstractRecord) line:
>> >>>>> 437
>> >>>>> ReadObjectQuery(ObjectLevelReadQuery).buildObject(AbstractRecord)
>> >>>>>
>> >>>> line:
>> >>>>
>> >>>>> 571
>> >>>>> ReadObjectQuery.registerResultInUnitOfWork(Object, UnitOfWorkImpl,
>> >>>>> AbstractRecord, boolean) line: 712
>> >>>>> ReadObjectQuery.executeObjectLevelReadQuery() line: 436
>> >>>>> ReadObjectQuery(ObjectLevelReadQuery).executeDatabaseQuery() line:
>> >>>>> 930
>> >>>>>
>> >>>>> ReadObjectQuery(DatabaseQuery).execute(AbstractSession,
>> >>>>>
>> >>>> AbstractRecord)
>> >>>>
>> >>>>> line: 664
>> >>>>> ReadObjectQuery(ObjectLevelReadQuery).execute(AbstractSession,
>> >>>>> AbstractRecord) line: 891
>> >>>>> ReadObjectQuery.execute(AbstractSession, AbstractRecord) line: 397
>> >>>>>
>> >>>>>
>> >>>> ReadObjectQuery(ObjectLevelReadQuery).executeInUnitOfWork(UnitOfWorkIm
>> >>>> pl
>> >>>>
>> >>>>> , AbstractRecord) line: 954
>> >>>>>
>> >>>>>
>> >>>> RepeatableWriteUnitOfWork(UnitOfWorkImpl).internalExecuteQuery(Databas
>> >>>> eQ
>> >>>>
>> >>>>> uery, AbstractRecord) line: 2697
>> >>>>>
>> >>>>>
>> >>> RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery,
>> >>>
>> >>>>> AbstractRecord, int) line: 1181
>> >>>>>
>> >>>>>
>> >>> RepeatableWriteUnitOfWork(AbstractSession).executeQuery(DatabaseQuery,
>> >>>
>> >>>>> AbstractRecord) line: 1165
>> >>>>> QueryBasedValueHolder.instantiate(AbstractSession) line: 77
>> >>>>> QueryBasedValueHolder.instantiate() line: 67
>> >>>>> QueryBasedValueHolder(DatabaseValueHolder).getValue() line: 83
>> >>>>> UnitOfWorkQueryValueHolder(UnitOfWorkValueHolder).instantiateImpl()
>> >>>>> line: 161
>> >>>>> UnitOfWorkQueryValueHolder(UnitOfWorkValueHolder).instantiate() line:
>> >>>>> 230
>> >>>>> UnitOfWorkQueryValueHolder(DatabaseValueHolder).getValue() line: 83
>> >>>>> CpTransCoverage._persistence_getcpTransaction() line: not available
>> >>>>> CpTransCoverage._persistence_setcpTransaction(CpTransaction) line:
>> >>>>>
>> >>> not
>> >>>
>> >>>>> available
>> >>>>> CpTransCoverage.setCpTransaction(CpTransaction) line: 135
>> >>>>> CpTransaction.setCpTerrorismCoverage(CpTransCoverage) line: 2226
>> >>>>> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> >>>>> available [native method]
>> >>>>> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 79
>> >>>>> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
>> >>>>> Method.invoke(Object, Object...) line: 618
>> >>>>> PrivilegedAccessHelper.invokeMethod(Method, Object, Object[]) line:
>> >>>>>
>> >>>> 344
>> >>>> WeavedObjectBasicIndirectionPolicy.setRealAttributeValueInObject(Objec
>> >>>> t,
>> >>>>
>> >>>>> Object) line: 125
>> >>>>> WeavedObjectBasicIndirectionPolicy.updateValueInObject(Object,
>> >>>>>
>> >>> Object,
>> >>>
>> >>>>> Object) line: 93
>> >>>>>
>> >>>>>
>> >>>> WeavedObjectBasicIndirectionPolicy.getRealAttributeValueFromObject(Obj
>> >>>> ec
>> >>>>
>> >>>>> t, Object) line: 61
>> >>>>>
>> >>>>>
>> >>>> OneToOneMapping(ForeignReferenceMapping).getRealAttributeValueFromAttr
>> >>>> ib
>> >>>>
>> >>>>> ute(Object, Object, AbstractSession) line: 614
>> >>>>>
>> >>>>>
>> >>>> OneToOneMapping(ObjectReferenceMapping).getRealAttributeValueFromAttri
>> >>>> bu
>> >>>>
>> >>>>> te(Object, Object, AbstractSession) line: 277
>> >>>>>
>> >>>>>
>> >>>> OneToOneMapping(DatabaseMapping).getRealAttributeValueFromObject(Objec
>> >>>> t,
>> >>>>
>> >>>>> AbstractSession) line: 549
>> >>>>> OneToOneMapping(ObjectReferenceMapping).mergeIntoObject(Object,
>> >>>>>
>> >>>> boolean,
>> >>>>
>> >>>>> Object, MergeManager) line: 403
>> >>>>> ObjectBuilder.mergeIntoObject(Object, boolean, Object, MergeManager,
>> >>>>> boolean, boolean) line: 2578
>> >>>>> MergeManager.mergeChangesOfCloneIntoWorkingCopy(Object) line: 500
>> >>>>> MergeManager.mergeChanges(Object, ObjectChangeSet) line: 267
>> >>>>>
>> >>>>>
>> >>>> RepeatableWriteUnitOfWork(UnitOfWorkImpl).mergeCloneWithReferences(Obj
>> >>>> ec
>> >>>>
>> >>>>> t, MergeManager) line: 3334
>> >>>>> RepeatableWriteUnitOfWork.mergeCloneWithReferences(Object,
>> >>>>>
>> >>>> MergeManager)
>> >>>>
>> >>>>> line: 257
>> >>>>>
>> >>>>>
>> >>>> RepeatableWriteUnitOfWork(UnitOfWorkImpl).mergeCloneWithReferences(Obj
>> >>>> ec
>> >>>>
>> >>>>> t, int, boolean) line: 3298
>> >>>>> EntityManagerImpl.mergeInternal(Object) line: 296
>> >>>>> EntityManagerImpl.merge(T) line: 274
>> >>>>> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> >>>>> available [native method]
>> >>>>> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 79
>> >>>>> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
>> >>>>> Method.invoke(Object, Object...) line: 618
>> >>>>>
>> >>>>>
>> >>>> SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke
>> >>>> (O
>> >>>>
>> >>>>> bject, Method, Object[]) line: 198
>> >>>>> $Proxy43.merge(Object) line: not available
>> >>>>> CpTransactionManagerImpl.update(CpTransaction) line: 180
>> >>>>> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> >>>>> available [native method]
>> >>>>> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 79
>> >>>>> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
>> >>>>> Method.invoke(Object, Object...) line: 618
>> >>>>> AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[])
>> >>>>>
>> >>>> line:
>> >>>>
>> >>>>> 307
>> >>>>> ReflectiveMethodInvocation.invokeJoinpoint() line: 182
>> >>>>> ReflectiveMethodInvocation.proceed() line: 149
>> >>>>> PersistenceExceptionTranslationInterceptor.invoke(MethodInvocation)
>> >>>>> line: 138
>> >>>>> ReflectiveMethodInvocation.proceed() line: 171
>> >>>>> TransactionInterceptor.invoke(MethodInvocation) line: 106
>> >>>>> ReflectiveMethodInvocation.proceed() line: 171
>> >>>>> JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
>> >>>>> $Proxy58.update(CpTransaction) line: not available
>> >>>>> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> >>>>> available [native method]
>> >>>>> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 79
>> >>>>> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
>> >>>>> Method.invoke(Object, Object...) line: 618
>> >>>>> AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[])
>> >>>>>
>> >>>> line:
>> >>>>
>> >>>>> 307
>> >>>>> ReflectiveMethodInvocation.invokeJoinpoint() line: 182
>> >>>>> ReflectiveMethodInvocation.proceed() line: 149
>> >>>>> TransactionInterceptor.invoke(MethodInvocation) line: 106
>> >>>>> ReflectiveMethodInvocation.proceed() line: 171
>> >>>>> JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
>> >>>>> $Proxy59.update(CpTransaction) line: not available
>> >>>>> PropertyAction(CppBaseAction).persistCpTrans(CpTransaction,
>> >>>>> HttpServletRequest) line: 1195
>> >>>>>
>> >>>>>
>> >>>>> This is happening on the udpate of the enitity I added the queryhint
>> >>>>> to on the find.
>> >>>>> Seems like it keeps circulating between the CpTransCoverage entity
>> >>>>> and
>> >>>>>
>> >>>>> the CpTransaction.
>> >>>>>
>> >>>>> Any ideas on this one?
>> >>>>>
>> >>>>> -----Original Message-----
>> >>>>> From: eclipselink-users-bounces@xxxxxxxxxxx
>> >>>>> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Tom Ware
>> >>>>> Sent: Wednesday, May 20, 2009 10:55 AM
>> >>>>> To: Tom Ware
>> >>>>> Cc: EclipseLink User Discussions
>> >>>>> Subject: Re: [eclipselink-users] Cache hit
>> >>>>>
>> >>>>> Sorry...  accidentally hit send too early.
>> >>>>>
>> >>>>> Here's the info about the refresh hint:
>> >>>>>
>> >>>>> http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#R
>> >>>>> e
>> >>>>> fr
>> >>>>> esh
>> >>>>>
>> >>>>> I apologize for giving you information that solves a more complex
>> >>>>> problem than the one you are encountering in my initial response.
>> >>>>> The
>> >>>>>
>> >>>>> cache usage setting relates to how EclipseLink will determine whether
>> >>>>>
>> >>>
>> >>>
>> >>>>> an object exists or not, rather than a simple refresh.
>> >>>>>
>> >>>>> -Tom
>> >>>>>
>> >>>>> Tom Ware wrote:
>> >>>>>
>> >>>>>> Have you tried entityManager.refresh(object) that will guarantee SQL
>> >>>>>>
>> >>>
>> >>>
>> >>>>>> goes to the  DB?
>> >>>>>>
>> >>>>>> The refresh hint on your query will also likely solve your issue:
>> >>>>>>
>> >>>>>>
>> >>>>>> If that solves you
>> >>>>>>
>> >>>>>> khaskett wrote:
>> >>>>>>
>> >>>>>>> I changed the code for a find to be this - <code>
>> >>>>>>>             final String queryString = "select model from
>> >>>>>>> CpTransaction model where model.transactionId = :propertyValue";
>> >>>>>>>             final Query query = em.createQuery(queryString);
>> >>>>>>>             query.setParameter("propertyValue", id);
>> >>>>>>>             query.setHint(QueryHints.CACHE_USAGE,
>> >>>>>>> CacheUsage.DoNotCheckCache);
>> >>>>>>>             return (CpTransaction) query.getSingleResult(); </code>
>> >>>>>>>
>> >>>>>>> And now I see this call in the logs -
>> >>>>>>>
>> >>>>>>> [5/20/09 10:34:50:203 CDT] 0000003e SystemOut     O [EL Fine]:
>> >>>>>>>
>> >>>>> 2009-05-20
>> >>>>>
>> >>>>>>> 10:34:50.203--ServerSession(421796132)--Connection(1967945036)--Thr
>> >>>>>>> e
>> >>>>>>> a
>> >>>>>>> d(Thread[WebContainer
>> >>>>>>>
>> >>>>>>> : 4,5,main])--SELECT TRANSACTION_ID, PREMIUM_ACTUAL, PREMIUM_NET,
>> >>>>>>> AUDIT_REPORT, REINSURANCE_TYPE, TRANSITION_YEAR, INSURED_EMAIL,
>> >>>>>>> CREATION_DATE, PREVIOUS_POLICY_NUMBER, PREMIUM_TARGET,
>> >>>>>>> COMPANY_CODE,
>> >>>>>>>
>> >>>>>>> BILL_CHANGE, DELETION_DATE, BILL_TYPE_RENEWAL, LOCK_SESSION,
>> >>>>>>> TRANSACTION_STATUS, DEC_IND, PROGRAM_TYPE, PRINT_NOTICE,
>> >>>>>>> PROCESSING_DATE, INSURED_SUPPLEMENTARY_TYPE, TRANSACTION_UW,
>> >>>>>>> SETUP_DATE, MAIL_TYPE, EXCLUDE_PKG_DISC, REASON_CODE,
>> >>>>>>> PT_EMPLOYEE_COUNT, DOC_MGMT_FLAG, BILL_PLAN_RENEWAL,
>> >>>>>>> SHORT_TERM_FACTOR, RATE_EFFECTIVE_DATE, PCT_TERM, ACORD_FLAG,
>> >>>>>>> INSURED_SUPPLEMENTARY_NAME, LOCK_EDITOR, BILL_PLAN, EMPLOYEE_COUNT,
>> >>>>>>>
>> >>>
>> >>>
>> >>>>>>> TRANSACTION_FORMAT, BILL_ACCOUNT, TRANSACTION_FLAG,
>> >>>>>>> RELATED_POLICY_NUMBER, PREMIUM_PREVIOUS, INSURED_FAX,
>> >>>>>>> REINSURANCE_COST, RATE_LEVEL, OOS_DATA, PREMIUM_WAIVED_IND,
>> >>>>>>> TRANSACTION_DESC, TRANSACTION_LABEL, RATING_FLAG,
>> >>>>>>> MODIFICATION_DATE,
>> >>>>>>>
>> >>>>>>> PRIMARY_STATE, POLICY_NUMBER, INSURED_PHONE, PRODUCER, PREMIUM_MIN,
>> >>>>>>>
>> >>>
>> >>>
>> >>>>>>> TRANSACTION_TYPE, PARENT_TRANSACTION_ID, CONTACT_PHONE, BILL_TYPE,
>> >>>>>>> BILL_TO_RENEWAL, APPROVAL_INITIALS, EFFECTIVE_DATE, BILL_TO,
>> >>>>>>> PREMIUM_RECALC_MIN_IND, RENEWAL_TYPE, ACCOUNT_NUM, SUSPENSE_NUMBER,
>> >>>>>>>
>> >>>
>> >>>
>> >>>>>>> SHORT_TERM_INDICATOR, INSURED_NAME, SUSPENSE_AMT,
>> >>>>>>> BUSINESS_TYPE_DETAIL, CONTACT_NAME, LOCK_OWNER, POLICY_TYPE,
>> >>>>>>> BUSINESS_TYPE, BUSINESS_DESCRIPTION, EXPIRATION_DATE,
>> >>>>>>> PREMIUM_WAIVED, INSURED_FEIN, REASON_DESC, CONTRACT_NUMBER,
>> >>>>>>> CHANGE_DATE, RATE_TABLE_DATE, DENY_FLAG, REINSURANCE_COMPANY,
>> >>>>>>> YRS_BUS, AGENCY_EFT, AGT_RESET, AUDIT_TYPE, POLICY_LOB,
>> >>>>>>> PREMIUM_MEET_MIN, AUDIT_NAME, INSURED_MAILING_NAME, BUSINESS_PHONE,
>> >>>>>>>
>> >>>
>> >>>
>> >>>>>>> POLICY_PMA, ACTION_CODE, INSURED_CITY, INSURED_COUNTY,
>> >>>>>>> INSURED_ADDRESS_2, INSURED_ADDRESS_1, INSURED_STATE,
>> >>>>>>> INSURED_POSTAL_CODE FROM CP_TRANSACTION WHERE (TRANSACTION_ID =
>> >>>>>>> CAST (? AS BIGINT ))
>> >>>>>>>     bind => [32967]
>> >>>>>>>
>> >>>>>>> But I am getting an old copy of the data.  I can use a tool like
>> >>>>>>> SQLSquirrel and I see that it has data that is not reflected in
>> >>>>>>> what
>> >>>>>>>
>> >>>>>>> is being returned by the find.
>> >>>>>>>
>> >>>>>>> How is that possible?
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> tware wrote:
>> >>>>>>>
>> >>>>>>>> Although the following are not specifically for "find" operations,
>> >>>>>>>>
>> >>>
>> >>>
>> >>>>>>>> they may be helpful.
>> >>>>>>>>
>> >>>>>>>> First, try writing a query that makes use of caching hints:
>> >>>>>>>>
>> >>>>>>>> http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%2
>> >>>>>>>> 9
>> >>>>>>>> #
>> >>>>>>>> Cache_Usage
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> For configuring on a more broad scale there are some entity-level
>> >>>>>>>> config options here:
>> >>>>>>>>
>> >>>>>>>> http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%2
>> >>>>>>>> 9
>> >>>>>>>> #
>> >>>>>>>> How_to_Use_the_.40Cache_Annotation
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> khaskett wrote:
>> >>>>>>>>
>> >>>>>>>>> Is there a way on a find, to know if the value returned was from
>> >>>>>>>>> the cache or was a DB read?  Or is there a way to always force a
>> >>>>>>>>> read from the database on a find?
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> _______________________________________________
>> >>>>>>>> eclipselink-users mailing list
>> >>>>>>>> eclipselink-users@xxxxxxxxxxx
>> >>>>>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>> _______________________________________________
>> >>>>> eclipselink-users mailing list
>> >>>>> eclipselink-users@xxxxxxxxxxx
>> >>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>>>>
>> >>>>>
>> >>>>> This message (including any attachments) is intended only for the use
>> >>>>>
>> >>>
>> >>>
>> >>>>> of the individual or entity to which it is addressed and may contain
>> >>>>> information that is non-public, proprietary, privileged,
>> >>>>> confidential,
>> >>>>>
>> >>>>> and exempt from disclosure under applicable law or may constitute as
>> >>>>> attorney work product.
>> >>>>> If you are not the intended recipient, you are hereby notified that
>> >>>>> any use, dissemination, distribution, or copying of this
>> >>>>> communication
>> >>>>>
>> >>>>> is strictly prohibited. If you have received this communication in
>> >>>>> error, notify us immediately by telephone and
>> >>>>> (i) destroy this message if a facsimile or (ii) delete this message
>> >>>>> immediately if this is an electronic communication.
>> >>>>>
>> >>>>> Thank you.
>> >>>>> _______________________________________________
>> >>>>> eclipselink-users mailing list
>> >>>>> eclipselink-users@xxxxxxxxxxx
>> >>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>>>>
>> >>>> _______________________________________________
>> >>>> eclipselink-users mailing list
>> >>>> eclipselink-users@xxxxxxxxxxx
>> >>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>>>
>> >>>>
>> >>>> This message (including any attachments) is intended only for the use
>> >>>> of the individual or entity to which it is addressed and may contain
>> >>>> information that is non-public, proprietary, privileged, confidential,
>> >>>>
>> >>>
>> >>>
>> >>>> and exempt from disclosure under applicable law or may constitute as
>> >>>> attorney work product.
>> >>>> If you are not the intended recipient, you are hereby notified that
>> >>>> any use, dissemination, distribution, or copying of this communication
>> >>>>
>> >>>
>> >>>
>> >>>> is strictly prohibited. If you have received this communication in
>> >>>> error, notify us immediately by telephone and
>> >>>> (i) destroy this message if a facsimile or (ii) delete this message
>> >>>> immediately if this is an electronic communication.
>> >>>>
>> >>>> Thank you.
>> >>>> _______________________________________________
>> >>>> eclipselink-users mailing list
>> >>>> eclipselink-users@xxxxxxxxxxx
>> >>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>>>
>> >>> _______________________________________________
>> >>> eclipselink-users mailing list
>> >>> eclipselink-users@xxxxxxxxxxx
>> >>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>>
>> >>>
>> >>> This message (including any attachments) is intended only for
>> >>> the use of the individual or entity to which it is addressed and
>> >>> may contain information that is non-public, proprietary,
>> >>> privileged, confidential, and exempt from disclosure under
>> >>> applicable law or may constitute as attorney work product.
>> >>> If you are not the intended recipient, you are hereby notified
>> >>> that any use, dissemination, distribution, or copying of this
>> >>> communication is strictly prohibited. If you have received this
>> >>> communication in error, notify us immediately by telephone and
>> >>> (i) destroy this message if a facsimile or (ii) delete this message
>> >>> immediately if this is an electronic communication.
>> >>>
>> >>> Thank you.
>> >>> _______________________________________________
>> >>> eclipselink-users mailing list
>> >>> eclipselink-users@xxxxxxxxxxx
>> >>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>>
>> >> _______________________________________________
>> >> eclipselink-users mailing list
>> >> eclipselink-users@xxxxxxxxxxx
>> >> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context: http://www.nabble.com/Cache-hit-tp23619031p24117816.html
>> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>


Back to the top