Bug 251594 - add missing query hints
Summary: add missing query hints
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2008-10-21 15:10 EDT by James Sutherland CLA
Modified: 2022-06-09 10:32 EDT (History)
1 user (show)

See Also:


Attachments
Adds missing query hints (94.92 KB, patch)
2008-11-18 11:07 EST, James Sutherland CLA
no flags Details | Diff
Adds 2nd set of query hints and fixes (231.76 KB, patch)
2008-11-26 15:43 EST, James Sutherland CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Sutherland CLA 2008-10-21 15:10:59 EDT
Add query hints for all missing functionality of the query framework:
- maintain-cache
- session-name
- prepare
- jdbc.cache-statement
- sql.hint
- flush
- jdbc.native-connection
- sql
- call
- redirect
- expression
- query-type +support all query types
- result-type (Map, Array, Value, Values)
- cursor
- cursor.initial-size
- cursor.page-size
- cursor.scrollable
- cursor.scrollable.result-set-type (Forward, ForwardOnly, Unknown, Reverse, ScrollInsensitive, ScrollSensitive)
- cursor.scrollable.result-set-concurrency (ReadOnly, Updatable)
- cursor.size-query
- fetch-group.name
- fetch-group.attribute
- fetch-group.default
- cache-usage.indirection-policy (Include, Exclude, ThrowException, Trigger)
- cache-usage +support modify queries
- exclusive-connection
- inheritance.outer-join
- history.as-of
- history.as-of-scn
- example-object
- example-object.policy
- hierarchical.connect-by
- hierarchical.start-with
- hierarchical.order-siblings
- jdbc.first-result

The hierarchical probably needs to be added to JPQL instead of hints.
Comment 1 James Sutherland CLA 2008-10-21 15:16:26 EDT
Also need to fix the multi hints (batch, fetch) currently storing hints in a Map prevents these from working.

Also for fetch hint need outer join option.
Comment 2 Tom Ware CLA 2008-10-22 10:44:38 EDT
Setting to Future due to large set of query hints.  If a subset are more important, we can move them to a new bug with a nearer Target Milestone
Comment 3 James Sutherland CLA 2008-11-13 13:59:15 EST
Also,
- redirect alredy exists as query.redirector, but needs to be extended to take a class name, currently only takes an instance, which does not work from meta-data
- native queries are always created as DataRead, and not all properties copied over if switched to DataModify, need to use copyFromQuery(), current code will also fail for existing NamedStoredProcedureQuery.
- native queries currently return Vector of values, but spec requires array
- getSingleResult should allow returning of Cursors and Maps, (and Sets?)
- need to add getCursorResult()

Decided not to add sql, native queries can do everything for this.
Decided not to add call, expression, example, as should be EntityManager API and could not use from meta-data.
Decided not to add connectby as should be part of JPQL and could not use from meta-data.
Decided not to add session-name, as only for SessionBroker, should be added when SessionBroker support is added.
Comment 4 James Sutherland CLA 2008-11-13 15:48:47 EST
Also result-collection-class does not use correct class loader, and does not set the collection into DataReadQuery types.
Comment 5 James Sutherland CLA 2008-11-18 11:07:35 EST
Created attachment 118147 [details]
Adds missing query hints
Comment 6 James Sutherland CLA 2008-11-18 11:11:21 EST
This patch adds the following hints,
- maintain-cache
- prepare
- jdbc.cache-statement
- sql.hint
- flush
- jdbc.native-connection
- cursor
- cursor.initial-size
- cursor.page-size
- cursor.scrollable
- cursor.size-sql
- fetch-group.name
- fetch-group.attribute
- fetch-group.default
- cache-usage +support modify queries
- exclusive-connection
- inheritance.outer-join
- history.as-of
- history.as-of-scn
- jdbc.first-result

Also fixed,
- native queries are always created as DataRead, and not all properties copied
over if switched to DataModify, need to use copyFromQuery(), current code will
also fail for existing NamedStoredProcedureQuery.
- getSingleResult should allow returning of Cursors and Maps, (and Sets)
- need to add getResultCursor()

And improved all hint comments.
Comment 7 James Sutherland CLA 2008-11-26 15:36:23 EST
This patch adds the following query hints:
- query-type +support all query types
- result-type (Map, Array, Value, Values)
- cursor.scrollable.result-set-type (Forward, ForwardOnly, Unknown, Reverse,
ScrollInsensitive, ScrollSensitive)
- cursor.scrollable.result-set-concurrency (ReadOnly, Updatable)
- fetch-group
- cache-usage.indirection-policy (Include, Exclude, ThrowException, Trigger)
- left-fetch

Other changes include:
- Query redirector hint take class name or class as well as instance
- Fixed convertClassNameToClasses for container policy, allows user collections
- Added ResultType support to DataReadQuery
- Simplified Direct/ValueReadQuery
- Fixed setting of fetch group to unprepare query
- Better defined ResultType for ReportQuery
- Added tests for query hints
- Added tests for modify named stored procedures, SQLResultSetMapping, cursors, and join fetching.
- Changed Department to use lazy fetching on 1-m's
- Changed Customer to use custom collection type
- Fixed query hints to allow Map with array values
- Fixed native query result type
- Added class loader to query creation and hints so correct loader is used
- Added query creation API to JpaEntityManager, change existing API to use List
- Some cleanup
Comment 8 James Sutherland CLA 2008-11-26 15:43:56 EST
Created attachment 118839 [details]
Adds 2nd set of query hints and fixes
Comment 9 James Sutherland CLA 2009-01-13 13:08:55 EST
Closing
Comment 10 Eclipse Webmaster CLA 2022-06-09 10:15:54 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 11 Eclipse Webmaster CLA 2022-06-09 10:32:12 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink