Summary: | JPA PK QUERY DOES NOT CHECK CACHE AND ISSUES SQL | ||||||
---|---|---|---|---|---|---|---|
Product: | z_Archived | Reporter: | Shaun Smith <shaun.smith> | ||||
Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | minor | ||||||
Priority: | P2 | CC: | jamesssss, tom.ware | ||||
Version: | unspecified | Keywords: | performance | ||||
Target Milestone: | --- | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Shaun Smith
2009-01-14 14:32:42 EST
What version is this a regression from? Targetting for 1.1X since this should be considered a candidate for a patch set after 1.1 This has never worked, JPQL queries do not get cache hits by default. They are executed as ReadAllQuery's. You can configure this, use the query hint "eclipselink.cache-usage"="CheckCacheByPrimaryKey". or, "eclipselink.query-type"="ReadObject" The issues as to why you need to set the hint include: - When the query is created we don't know if getResultList() or getSingleResult() will be used, so always use a ReadAllQuery. - JPA requires an error if the query returns more than one row, so a ReadAllQuery is used for getSingleResult() - We don't know the JPQL is a primary key query without extra processing. We might want to try to default to using ReadObject if a pk query and getSingleResult() is used, or at least have some global config default or something. I have verified the usage of hints and also agree that the default usage can be confusing to users who just expect cache hits. Deferring to 2.0 for now. This bug fix did not make the cut off for 2.0.0. We are deferring the bugs to Future where we can properly sort them all together based on community votes and severity. We will then assign them accordingly to future patch sets and releases. Changing the priority of the bugs that have been recently triaged to future. Targetting them to P2 will differentiate them from the P3s that have been triaged into future earlier. Created attachment 168193 [details]
patch for cache hits and several other bugs
SVN trunk commit: Bug#261076 JPQL cache hits Also bugs, 298830, 307164, 255535, 261674, 264275 Changes: - Added method to check if an expression is by primary key - Changed pagination alias to use a1, a2, etc. instead of field names which can conflict, removed maxAliasLength - Fixed logging type - Removed some unnecessary getClass in registerNotRegisteredNewObjectForPersist - Added missing properties to query copying - Fixed cache check to check cache bypass flag - Disable cache check in ReadObjectQuery prepare if not a primary key expression - Create primary key JPQL queries as ReadObjectQuerys - Allow getResultList, getResultCollection if the query is a ReadObjectQuery - Fixed ElementCollection default mapping to use owning descriptor for embeddables - Fixed generics support to handle collection of a nested generic type - Added test for ElementCollection from an Embeddable - Added test for nested generics in Entity class and m-1, 1-m relationship - Added test for JPQL cache hits - Added test for native query hints - Exclude complex like tests unless Oracle Corporation The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |