straight_join in JPA or HIBERNATE

耗尽温柔 提交于 2019-12-04 13:16:35

There is no straight_join for JPQL/JPA.

You will need to use it in NativeQuery.

entityManager.createNativeQuery(...);

It should be possible in the Hibernate 5.2.12 and MySQL version 8 using optimizer hint JOIN_FIXED_ORDER (the same effect as STRAIGHT_JOIN) More information available under the links:

Jira ticket: https://hibernate.atlassian.net/browse/HHH-11906

Hibernate code change that allows this: https://github.com/hibernate/hibernate-orm/commit/72506a6eacc367297a3205f6e1fec7ccbc153799

Documentation for MySQL Optimizer hints: https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!