这有效:
@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 != :readonceflag
query.setParameter("readonceflag",null);
@Column(name="read_once")
public Boolean readOnce;
#sql
read_once boolean null,
那么,如何使用布尔属性实现非空检查?