使用标准API的Hibernate str()函数

使用标准API的Hibernate str()函数,hibernate,hql,criteria,Hibernate,Hql,Criteria,如何使用HQL str()函数,该函数用于将数值转换为带条件API的可读字符串?我认为,您不需要带条件API的str()函数,因为您可以先将数值转换为带API函数的字符串,如:Integer.toString(),然后设置为参数like List cats = sess.createCriteria(Cat.class) .add( Restrictions.like("age", Integer.toString(age) ) ) .list();

如何使用HQL str()函数,该函数用于将数值转换为带条件API的可读字符串?

我认为,您不需要带条件API的str()函数,因为您可以先将数值转换为带API函数的字符串,如:Integer.toString(),然后设置为参数like

List cats = sess.createCriteria(Cat.class)
    .add( Restrictions.like("age", Integer.toString(age) ) )
    .list();