这是可行的:
@NamedQuery(name="all_submissions",query="select s from Submission s where (s.id= :id or s.testCode= :code or s.user.email = :email) and s.readOnce != NULL")s.readOnce != NULL
但这不管用
@NamedQuery(name="search_submissions",query="select s from Submission s where (s.id= :id or s.user.email = :email or s.testCode = :code) and s.readOnce != :readonceflag")s.readOnce !=:读取标记
query.setParameter("readonceflag",null);
@Column(name="read_once")
public Boolean readOnce;
#sql
read_once boolean null,那么,如何使用布尔型属性实现非空检查呢?
发布于 2013-04-21 01:40:43
有效的语法类似于SQL:where s.readOnce is not null。您必须将null视为特殊情况。您不能用=与null进行比较。在SQL中,Nothing不等于null,甚至不等于null。
https://stackoverflow.com/questions/16123262
复制相似问题