How to use select straight_join ... from ...
in hibernate/jpa?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With