Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Query caching for report queries?

Also check out EhCache for obvious caching situations. I've been
having good luck with it, it takes some of the magic out of caching.

./tch



On Tue, Oct 19, 2010 at 6:41 PM, Phillip Ross
<phillip.w.g.ross@xxxxxxxxx> wrote:
> Thanks James, I'll try your suggested work around along with a few of my own
> to see what I come up with.  But I'll log a bug in the meantime so this can
> be fixed.
> Thanks again
> - Phillip
>
> On Tue, Oct 19, 2010 at 2:04 PM, James Sutherland <jamesssss@xxxxxxxxx>
> wrote:
>>
>> This is a bug in caching query results and using report queries.
>> Please log the bug and vote for it.
>>
>> The issue is the query is trying to register the cached results in the
>> unit
>> of work, and is assuming is has objects.  Report query will need to do
>> something different.
>>
>> Is the ReportQuery for data, or for objects and data?
>>
>> A workaround may be to use native SQL with a DataReadQuery.
>>
>>
>>
>> Phillip Ross-4 wrote:
>> >
>> > Posting this to the correct list may get better response :)
>> >
>> > Hi all... does eclipselink support caching results of report queries?  I
>> > could swear I've done this in the past but attempting with a recent
>> > eclipselink v2.1.1 and some JPA code I was getting an odd error.  Since
>> > The
>> > previous times I've worked with query caching it was with older versions
>> > of
>> > toplink/eclipselink that did not use JPA, but used the native query
>> > interface.
>> >
>> > I reimplemented code as native eclipselink queries and oddly I get the
>> > same
>> > error.  Error and fullstack trace follow, but the error only occurs when
>> > caching has been turned on for the query, otherwise it works fine and
>> > returns results, albeit it generating db queries and retrieving results
>> > from
>> > the db on every query execution.
>> >
>> > Exception [EclipseLink-26] (Eclipse Persistence Services -
>> > 2.1.1.v20100817-r8050):
>> > org.eclipse.persistence.exceptions.DescriptorException
>> > Exception Description: Trying to get value for instance variable [id] of
>> > type [long] from the object
>> > [org.eclipse.persistence.queries.ReportQueryResult].  The specified
>> > object
>> > is not an instance of the class or interface declaring the underlying
>> > field.
>> > Internal Exception: java.lang.IllegalArgumentException: Can not set long
>> > field com.phillipross.testing.model.Message.id to
>> > org.eclipse.persistence.queries.ReportQueryResult
>> > Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[id-->
>> > MESSAGE.ID]
>> > Descriptor: RelationalDescriptor(com.phillipross.testing.model.Message
>> > -->
>> > [DatabaseTable(MESSAGE)])
>> >         at
>> >
>> > org.eclipse.persistence.exceptions.DescriptorException.illegalArgumentWhileGettingValueThruInstanceVariableAccessor(DescriptorException.java:629)
>> >         at
>> >
>> > org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor.getAttributeValueFromObject(InstanceVariableAttributeAccessor.java:79)
>> >         at
>> >
>> > org.eclipse.persistence.mappings.DatabaseMapping.getAttributeValueFromObject(DatabaseMapping.java:497)
>> >         at
>> >
>> > org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.valueFromObject(AbstractDirectMapping.java:1218)
>> >         at
>> >
>> > org.eclipse.persistence.internal.descriptors.ObjectBuilder.extractPrimaryKeyFromObject(ObjectBuilder.java:2133)
>> >         at
>> >
>> > org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3936)
>> >         at
>> >
>> > org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:368)
>> >         at
>> >
>> > org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1112)
>> >         at
>> >
>> > org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2909)
>> >         at
>> >
>> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1291)
>> >         at
>> >
>> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1273)
>> >         at
>> >
>> > org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1233)
>> >         at
>> > com.phillipross.testing.TestPersistence.testJpa(TestPersistence.java:53)
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >         at
>> >
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >         at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >         at java.lang.reflect.Method.invoke(Method.java:597)
>> >         at
>> > org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
>> >         at org.testng.internal.Invoker.invokeMethod(Invoker.java:627)
>> >         at
>> > org.testng.internal.Invoker.invokeTestMethod(Invoker.java:799)
>> >         at
>> > org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1103)
>> >         at
>> >
>> > org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
>> >         at
>> > org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
>> >         at org.testng.TestRunner.runWorkers(TestRunner.java:1098)
>> >         at org.testng.TestRunner.privateRun(TestRunner.java:727)
>> >         at org.testng.TestRunner.run(TestRunner.java:581)
>> >         at org.testng.SuiteRunner.runTest(SuiteRunner.java:315)
>> >         at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:310)
>> >         at org.testng.SuiteRunner.privateRun(SuiteRunner.java:272)
>> >         at org.testng.SuiteRunner.run(SuiteRunner.java:221)
>> >         at
>> > org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
>> >         at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
>> >         at
>> >
>> > org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
>> >         at
>> >
>> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> >         at
>> >
>> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> >         at java.lang.Thread.run(Thread.java:637)
>> >
>> >
>>
>>
>> -----
>> http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
>> http://www.eclipse.org/eclipselink/
>>  EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
>> TopLink
>> Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink ,
>> http://wiki.oracle.com/page/TopLink TopLink
>> Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
>> http://www.nabble.com/EclipseLink-f26430.html EclipseLink
>> Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
>> --
>> View this message in context:
>> http://old.nabble.com/Query-caching-for-report-queries--tp29969302p30002858.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