Hi everyone!
I would like to ask, if its possible to create also alias for property in sql restriction when querying with hibernate criteria.
Code:
Criteria c = this.getSession().createCriteria(Cat.class);
c.add(Restrictions.sqlRestriction("{alias}.CAT_NAME ilike ?","tom", Hibernate.STRING));
Is it also possible to create alias for column name? So the sql query depends not on database column name, the column name takes from mapping. So the query would look like :
Code:
Criteria c = this.getSession().createCriteria(Cat.class);
c.add(Restrictions.sqlRestriction("{alias}.name ilike ?","tom", Hibernate.STRING));
Property Cat.name would be mapped to column CAT_NAME
Is this possible ?
Also, I would like to ask, if it is possible to set the query object so, that it would ignore null or empty values;
So I add property with null or emty value and criteria will ignore it.
I want it because I dont want to write for every restriction null or empty value test.
Thanks a lot for your help