Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350484

Summary: Support indexes in the cache
Product: z_Archived Reporter: James Sutherland <jamesssss>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: karenfbutzke
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
adds cache index support and descriptor cache policy
none
updated patch none

Description James Sutherland CLA 2011-06-27 14:41:00 EDT
Currently cache hits can only occur on an Id field, cache indexes should be supported to allow any singleResult query to obtain a cache hit on any indexed field.


A common use case if when the object has a natural id, and a generated id as well.  Cache hits are still desired on the natural id.


Can also be useful for Oracle DCN to index object by its rowid.
Comment 1 James Sutherland CLA 2011-06-28 10:05:08 EDT
Created attachment 198730 [details]
adds cache index support and descriptor cache policy
Comment 2 James Sutherland CLA 2011-07-21 11:51:08 EDT
Created attachment 200104 [details]
updated patch
Comment 3 James Sutherland CLA 2011-07-25 10:52:22 EDT
SVN trunk commit: Bug#350484 cache index support

https://bugs.eclipse.org/bugs/show_bug.cgi?id=350484

Design,
http://wiki.eclipse.org/EclipseLink/DesignDocs/350484

Code review: Gord

Changes:
- Added @CacheIndex, @CacheIndexes annotations, xml and JPA meta-data processing
- Added 2-4 eclipselikn-orm schema
- Added CachePolicy to encapsulate all cache functionality of a descriptor
- Redirected all cache state/behavior to CachePolicy (old API still supported)
- Added CacheIndex and support to CachePolicy
- Changed primary key extraction from Expression to be able to extract any fields
- Index objects in the session cache when read/build from row.
- Removed duplicate postMerge event
- Fixed field name uppercasing
- Added map of cache index IdentityMaps to IdentityMapManager
- Added clear method for clearing indexes, clear indexes when clearing cache
- Methods to get/put CacheKey by index to IdentityMapManager
- Added cache index check to ExpressionQueryMechanism cache check, always conform result with expression.
- Added pre/postLogout Session events
- Added extensive comments to mergeChangesOfWorkingCopyIntoOriginal
- Added null check in merge to avoid double locking (all new objects were being locked twice)
- Removed managed new object without change set merge case that cannot occur
- Fixed @ClassExtractor to define required class type
- Added evict with invalidation in cluster option to JPA Cache
- Added index to core employee model and tests
- Added @CacheIndex usage to JPA advanced model and tests to AdvancedQueryTestSuite
Comment 4 Karen Butzke CLA 2011-08-30 12:46:07 EDT
James,
Was this support supposed to be added to the 2.3 schema?
Comment 5 Karen Butzke CLA 2011-08-30 13:46:43 EDT
I guess it doesn't really matter as long as it wasn't added in the 2.3 maintenance branch. the eclipselink_orm_2_3.xsd should be deleted from TRUNK anyway
Comment 6 Karen Butzke CLA 2011-08-30 14:09:28 EDT
James,
There is a mistake in the BasicAccessor constructor, the last 3 lines of code look incorrect. The CacheIndex annotation is being processed both for m_cacheIndex and m_index. This looks like it would break the Index support.
Comment 7 James Sutherland CLA 2011-09-14 10:47:18 EDT
Thanks for catching this Karen, will check in a fix soon.
Comment 8 James Sutherland CLA 2011-10-06 14:40:23 EDT
fixed
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:23:46 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink