Introduce a way to cache query plans for CriteriaQuery based on the query structure. One way to do that would be to generate HQL with stable aliases and use that as cache key. Another way could be to implement hashing and equality based on the query structure. |