Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362519 - DescriptorException occurs when attempting to use query results cache
Summary: DescriptorException occurs when attempting to use query results cache
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-31 13:53 EDT by Phillip Ross CLA
Modified: 2022-06-09 10:08 EDT (History)
2 users (show)

See Also:


Attachments
Output and stack trace from testcase. (13.91 KB, text/plain)
2011-10-31 13:56 EDT, Phillip Ross CLA
no flags Details
Scaled down test case (necessary jar files NOT included) (5.86 KB, application/octet-stream)
2011-10-31 14:11 EDT, Phillip Ross CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phillip Ross CLA 2011-10-31 13:53:32 EDT
Build Identifier: 2.3.0.v20110604-r9504

DescriptorException occurs when attempting to use query results cache with an aggregate query.  Full stack trace and a small test case will be attached.  Issue was discussed on eclipselink-users mailing list in Oct 2010 with James Sutherland who provided some insight into the problem:
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05373.html
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05374.html
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05392.html
http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg05398.html

Just getting around a year later to filing the issue which still exists in latest final release of eclipselink (2.3.0).

I've tried by using a query built in code as well as a named query.  The named query defined in annotations is as follows:
@NamedQuery(name="Purchase.findTotalPurchaseCount", query="select count(p) from Purchase p")

The initial query returns the result but subsequent invocations fail with a DescriptorException as follows (abbreviated):

[java] Local Exception Stack: 
     [java] Exception [EclipseLink-26] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DescriptorException
     [java] Exception Description: Trying to get value for instance variable [id] of type [long] from the object [java.lang.Long].  The specified object is not an instance of the class or interface declaring the underlying field.
     [java] Internal Exception: java.lang.IllegalArgumentException: Can not set long field testcase1.Purchase.id to java.lang.Long
     [java] Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[id-->PURCHASE.ID]
     [java] Descriptor: RelationalDescriptor(testcase1.Purchase --> [DatabaseTable(PURCHASE)])
     [java] 	at org.eclipse.persistence.exceptions.DescriptorException.illegalArgumentWhileGettingValueThruInstanceVariableAccessor(DescriptorException.java:645)
     [java] 	at org.eclipse.persistence.internal.descriptors.InstanceVariableAttributeAccessor.getAttributeValueFromObject(InstanceVariableAttributeAccessor.java:79)
     [java] 	at org.eclipse.persistence.mappings.DatabaseMapping.getAttributeValueFromObject(DatabaseMapping.java:516)

Reproducible: Always

Steps to Reproduce:
1.  Acquire apache ant (test case verified with apache-ant-1.8.2 but should work on earlier versions)
2.  Uncompress test case attachment file.
3.  Enter test case directory
4.  Execute ant command to invoke the clean target and the test target: "ant clean test" (without quotes)
Comment 1 Phillip Ross CLA 2011-10-31 13:56:49 EDT
Created attachment 206231 [details]
Output and stack trace from testcase.
Comment 2 Phillip Ross CLA 2011-10-31 14:02:02 EDT
Prepared a nice test case which reproduces the problem exactly but 8MB compressed is too big to attach to the bug.  Will try removing the eclipselink and derby jars, recompressed, and attempt to attach again.
Comment 3 Phillip Ross CLA 2011-10-31 14:11:55 EDT
Created attachment 206232 [details]
Scaled down test case (necessary jar files NOT included)

Attaching a stripped down testcase file.  This test case file has the dependent libraries removed and replaced with a file with the filenames and md5 checksums of the files that were removed.  Running the testcase will require obtaining the files separately:
- A derby.jar file from Oracle's OTN site, JavaDB 10.5.3 (http://www.oracle.com/technetwork/java/javadb/downloads/index.html)
- Eclipselink and javax.persistence jar file from eclipselink 2.3.0 download page:
(http://www.eclipse.org/eclipselink/downloads/index.php)
Comment 4 Tom Ware CLA 2011-11-17 13:54:31 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:08:05 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink