I am using spring-data for DB interaction. I want to see the jpa sql execution plan for a query written in repository. How can i do it.
https://vladmihalcea.com/execution-plan-oracle-hibernate-query-hints/ tells about using GATHER_PLAN_STATISTICS and COMMENT query hints. I added COMMENT hint but don't know how to add other one.
public interface StudentRepository extends JpaRepository<Student, Long>{
@QueryHints({
@QueryHint(name=org.hibernate.annotation.queryHints.COMMENT,
value="SQL_PLAN_STUDENT")
})
List<Student>findByStudentIDIn(List<Long> ids);
}
The
@QueryHintsannotation accepts an array constructor like list of@QueryHintitems.So you can add multiple
QueryHintsby addings them to a comma separated list. For example:Unfortunately I don't have access to a running instance of a oracle dbms, so I can't check the result of the given hint.