Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » query results cache for report queries?
query results cache for report queries? [message #917500] Thu, 20 September 2012 06:26 Go to next message
Knut Wannheden is currently offline Knut WannhedenFriend
Messages: 296
Registered: July 2009
Senior Member
Hi all,

I had a problem when I tried enabling the query results cache for a
named JPQL report query. Is that not supported?

An exception I seem to get occasionally (not always it seems like) when
executing the report query is:

Exception [EclipseLink-26] (Eclipse Persistence Services -
2.3.2.v20111125-r10461):
org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Trying to get value for instance variable
[version] of type [com.avaloq.tools.model.common.UUID] from the object
[com.avaloq.tools.model.internal.base.Version]. The specified object is
not an instance of the class or interface declaring the underlying field.
Internal Exception: java.lang.IllegalArgumentException: Can not set
com.avaloq.tools.model.common.UUID field
com.avaloq.tools.repository.configuration.server.ConfigurationUnitEntity.version
to com.avaloq.tools.model.internal.base.Version
Mapping: org.eclipse.persistence.mappings.AggregateObjectMapping[version]
Descriptor:
RelationalDescriptor(com.avaloq.tools.repository.configuration.server.ConfigurationUnitEntity
--> [DatabaseTable(COM_AVALOQ_TOOLS_CONFIGURATION.CONFIGURATIONUNIT)])
at
org.eclipse.persistence.exceptions.DescriptorException.illegalArgumentWhileGettingValueThruInstanceVariableAccessor(DescriptorException.java:645)
at
org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor.getAttributeValueFromObject(InstanceVariableAttributeAccessor.java:79)
at
org.eclipse.persistence.mappings.DatabaseMapping.getAttributeValueFromObject(DatabaseMapping.java:516)
at
org.eclipse.persistence.mappings.AggregateObjectMapping.writeFromObjectIntoRow(AggregateObjectMapping.java:1781)
at
org.eclipse.persistence.internal.descriptors.ObjectBuilder.extractPrimaryKeyFromObject(ObjectBuilder.java:2422)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3894)
at
org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:379)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1128)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1463)
at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:485)
at
org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:742)
at
com.avaloq.tools.repository.internal.server.ResourceEntityManager.namedQueryResults(ResourceEntityManager.java:338)
... <snip>
Caused by: java.lang.IllegalArgumentException: Can not set
com.avaloq.tools.model.common.UUID field
com.avaloq.tools.repository.configuration.server.ConfigurationUnitEntity.version
to com.avaloq.tools.model.internal.base.Version
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown
Source)
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown
Source)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(Unknown Source)
at java.lang.reflect.Field.get(Unknown Source)
at
org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor.getAttributeValueFromObject(InstanceVariableAttributeAccessor.java:76)
... 109 more

It seems like EclipseLink somehow tries to extract a primary key from
the object returned by the report query, even though that is not an
entity object but a POJO that was created by calling a constructor in
the SELECT clause of the JPQL query.

The report query was hinted with "eclipselink.query-results-cache" and
"eclipselink.query-results-cache.size" only.

Kind regards,

--knut
Re: query results cache for report queries? [message #923017 is a reply to message #917500] Tue, 25 September 2012 14:42 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

This seems to be a bug. The cached query results are attempting to be registered as objects, but are not.

Please log a bug for this issue and vote for it.

A workaround should be to set the "eclipselink.read-only"="true" query hint. This will avoid any registration, and should not be required for a ReportQuery anyway.


James : Wiki : Book : Blog : Twitter
Previous Topic:Help for migrating Toplink 9.0.3 to 11
Next Topic:AggregateCollectionMapping in DyanmicMapping
Goto Forum:
  


Current Time: Thu Nov 27 17:49:00 GMT 2014

Powered by FUDForum. Page generated in 0.02095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software