Criteria API code that searches via associated Entity ID does not work in Hibernate 5.4.1. while it still worked in Hibernate 5.2.18,
This happens if the association is an optional OneToOne mapped with PrimaryKeyJoinColumn. If the association is mapped optional=false the query still works.
The cause seem to be the commit https://github.com/hibernate/hibernate-orm/commit/2bfe30009c15ea59c587d11714d4be78b14f9ad9 and the partial revert in https://github.com/hibernate/hibernate-orm/commit/8535adc05736e9ae93d818d9aff25bf9255a1bbd
The attached test case works with 5.2.18, but fails in 5.4.1.