Seu the following mapping
@Entity public class User { private Integer id; @Id; private Integer getId() { return this.id; } }
According to Hibernate reference:
str() is used for converting numeric or temporal values to a readable string
So when i use
from User u where str(u.id) like :userId
It works fine