http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#criteria-narrowing
{code:java} List cats = sess.createCriteria(Cat.class) .add( Restrictions.sqlRestriction("lower({alias}.name) like lower(?)", "Fritz%", Hibernate.STRING) ) .list(); {code} The \ {alias \ } placeholder will be replaced by the row alias of the queried entity.
{code:java} @Formula("balance/(select sum(a.balance) from customer a where a.gender={alias}.gender)") private BigDecimal percentage; {code} here \ {alias \ } not resolved by row alias. |
|