I’m trying to switch boolean field using the following hql: Unfortunately “QuerySyntaxException: unexpected token: not near…” was thrown. My question is: is there some unary operator for hibernate that supports such expression? Or any well known trick? sql supports such queries (postgresql): Answer I would just use a native SQL query for this.