'How Hibernate process '?' [duplicate]

I'm new in Hibernate. I can't understand how Hibernate process ? in Restrictions.sqlRestriction() method. For example, there is a sample from official guide:

List cats = sess.createCriteria(Cat.class)
    .add( Restrictions.sqlRestriction("lower({alias}.name) like lower(?)", "Fritz%", Hibernate.STRING) )
    .list();

Looks like it is a placeholder. Will Hibernate convert this statement in ...like lower(Fritz%) SQL request?

If yes, then lower(Fritz%) doesn't looks valid, correct?



Solution 1:[1]

Yes, ? is a placeholder that is filled with "Fritz%".

% it's a wildcard, and it is often used with like like in this case.
Basically the query search for every Cat whose name start with "Fritz".

EDIT
I didn't get what was your concern with lower(Fritz%) at first, but as XtremeBaumer suggested, the query is actually converted to lower('Fritz%')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1