I have posted a question few days ago about Querying on collections with the Criteria API and after all the answers I see that the thing that I am trying is not possible wit
I have modified the Hibernate Criteria API to generate JPQL queries by trying to preserve the interface mostly similar. Name of my project is Criteria2JPQL at:
https://sourceforge.net/projects/criteria2jpql/
Since this translation is a simple in-memory operation that generates a standard JPQL query, there is not a considerable performance problem. On the other hand, the idea of this project has originated from the poor performing native sql queries of Hibernate Critera including lots of unnecessary joins. We have experienced using Criteria2JPQL in our project at my company and observed those unnecessary joins disappeared.