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.
@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:
SELECT
department0_.name AS NAME1_30_ FROM Department AS department0_
Thank you for your consideration. |