| Sorry all for the lack of updates. Reading Steve Ebersole's comments I understand this won't be easy to solve in 5.3, but with Hibernate ORM 6 the new semantic query model should make it possible to finally fix such issues, and enable for many more smart optimisations. A recap for those not following the developer's mailing list: the team has been working for some years now on the new semantic query model and it's finally feature complete, making Hibernate ORM 6 hopefully a reasonable goal for this year. Obviously we're slowed down by maintenance of the current branches so it all depends. In a nutshell, we had very limited capability in the current query handling strategy to change the structure of the query; this has been totally redesigned, based on requirements such as this very issue, but also the wish to generate much smarter queries. You could think of it - broadly speaking - as replacing a script which uses string replacement on patterns, to be replaced with a compiler. The new parser generates a semantic model from the parsed input and is able to output a totally different looking query to take advantage of any exotic needs the underlying database might have. I'm very much looking forward to this, so please be patient as working instead on sub-optimal patches like this one would drain away energy from the better goal. |