Hello Guenther,
The following commit in general describes my thoughts:
https://github.com/lukasz-antoniak/hibernate-core/commit/fa8427937f575117...
It probably needs some more tuning. Feel free to modify and test. I'm not sure if
adding "TOP(100)PERCENT" expression would not
harm performance too much.
Totally agree that we should simplify things. This is why I wanted to change the query
structure, so that aliases do not get
stripped from the original query, DISTINCT is not simulated with GROUP BY etc.
Regards,
Lukasz