编译 Java
If you are using the Hibernate native API, then you need to use the Query#setComment method like this:
1 | List<Person> persons = (List<Person>) session.createQuery( |
运行
If you are using JPA, then you can use a QueryHint:
1 | List<Person> persons = entityManager.createQuery( |
How to intercept and modify SQL queries with the Hibernate StatementInspector