Code:
criteria
.setProjections(
Property.name("prop1").as("prop1"))
.add(Restrictions.eq("prop1", someValue))
.list();
will generate invalid SQL because alias "prop1" is the same as property "prop1".
if add keyword "this" in restriction property as following, it will run!
Code:
criteria
.setProjections(
Property.name("prop1").as("prop1"))
.add(Restrictions.eq("this.prop1", someValue))
.list();
I have to write this kind of code, alias have the same name as property,
because I'm using AliasToBeanResultTransformer.
>to hibernate team:
This is a valid usage?
Because I'm afraid it will be changed in next version(I had met big troubles with HQL when version up 3.0 -> 3.1)
Regard,
Giang