Hi guys,
I have a question about creating a criteria. My current criteria looks like this:
Code:
final DetachedCriteria criteria = DetachedCriteria.forClass(AnyClass.class)
.add(Restrictions.ge("validTo", TODAY))
.add(Restrictions.le("validFrom", TODAY))
.addOrder(Order.asc("shortName"));
This criteria works fine. but now i want an additional criteria which theoretically looks like this
Code:
final DetachedCriteria criteria = DetachedCriteria.forClass(AnyClass.class)
.add(Restrictions.ge("validTo", TODAY))
.add(Restrictions.le("validFrom", TODAY))
.add(Restrictions.sizeEq("shortName", 4)) <--- LOOK HERE
.addOrder(Order.asc("shortName"));
the problem is that sizeeq does not support size resp length of a string..only size of a collection.. and this is exactly what i dont want! how can i do it in hibernate?!
in java it would look like this:
shortName.length() == 4
... Please help me.
------------------------------------------------------------------------------
Hibernate version: 3.2.5
Full stack trace of any exception that occurs:org.springframework.orm.hibernate3.HibernateSystemException: Unknown collection role.
=> This exception occurs because of misusing
Code:
sizeEq
Name and version of the database you are using: ORACLE 10g