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(Object,
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(UnitOfWorkImpl
, AbstractRecord) line: 954
RepeatableWriteUnitOfWork(UnitOfWorkImpl).internalExecuteQuery(DatabaseQ
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(Object,
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(UnitOfWorkImpl
, AbstractRecord) line: 954
RepeatableWriteUnitOfWork(UnitOfWorkImpl).internalExecuteQuery(DatabaseQ
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(Object,
Object) line: 125
WeavedObjectBasicIndirectionPolicy.updateValueInObject(Object, Object,
Object) line: 93
WeavedObjectBasicIndirectionPolicy.getRealAttributeValueFromObject(Objec
t, Object) line: 61
OneToOneMapping(ForeignReferenceMapping).getRealAttributeValueFromAttrib
ute(Object, Object, AbstractSession) line: 614
OneToOneMapping(ObjectReferenceMapping).getRealAttributeValueFromAttribu
te(Object, Object, AbstractSession) line: 277
OneToOneMapping(DatabaseMapping).getRealAttributeValueFromObject(Object,
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(Objec
t, MergeManager) line: 3334
RepeatableWriteUnitOfWork.mergeCloneWithReferences(Object,
MergeManager)
line: 257
RepeatableWriteUnitOfWork(UnitOfWorkImpl).mergeCloneWithReferences(Objec
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#Re
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)--Thre
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%29
#
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%29
#
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