We're updating the issue view to help you get more done. 

Support for Native/SQL Query Hints in Entity Mappings

Description

When defining entity mappings, it would be really useful to be able to provide optimizer hints to associations.

Much like the FetchType, the ability to provide a dialect specific query hints (i.e Oracle's +ALL_ROWS, +RESULT_CACHE etc.) for fetching would greatly improve performance in various implementations.

1 2 3 4 5 6 7 8 9 10 //Consider the following: @Entity public static class Employee { @Id @GeneratedValue public long id; @ManyToOne(fetch = FetchType.EAGER, fetchQueryHints= {"RESULT_CACHE"} ) public Department department; }

Query created to select from Department table using Oracle dialect would include:

1 2 SELECT /*+ RESULT_CACHE */ department0_.name AS NAME1_30_ FROM Department AS department0_

Thank you for your consideration.

Environment

None

Status

Assignee

Unassigned

Reporter

Erdem Memisyazici

Fix versions

None

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.9

Priority

Major