简体   繁体   English

ErrorCounter意外令牌,其中-休眠

[英]ErrorCounter Unexpected Token where - Hibernate

I am using jpa for queries. 我正在使用jpa进行查询。 My query is this : 我的查询是这样的:

public PartsItem getAvailablePartsItem(String search) {
    Session s = sessionFactory.openSession();
    PartsItem pi;
    pi = s.createQuery("from PartsItem where lower(serialNumber) like lower(:serialNumber) and where available = true", PartsItem.class).setParameter("serialNumber",'%' + search + '%').list().get(0);
    s.close();
    return pi;
}

I get an error with unexpected tokens at with where and available . 我在whereavailable处出现意外令牌错误。 I want these two conditions fulfilled but I keep getting these errors. 我希望这两个条件都得到满足,但我不断遇到这些错误。 Could it be an issue with the and ? 难道是用的问题and

您不应该具有final关键字where ,因此删除该关键字应该可以使其成功解析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM