Hibernate HQL query by using like operator

后端 未结 2 913
耶瑟儿~
耶瑟儿~ 2021-01-04 01:37

Seu the following mapping

@Entity
public class User {

    private Integer id;

    @Id;
    private Integer getId() {
        return this.id;
    }

}
         


        
2条回答
  •  猫巷女王i
    2021-01-04 02:22

    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

提交回复
热议问题