Java – negating unary operators in Hibernate QL

I'm trying to HQL switch Boolean fields using:

update Entity e set e.booleanField = not e.booleanField where e.id = ?1;

Unfortunately, "querysyntaxexception: unexpected token: not close..." is thrown

My question is: are there any hibernate unary operators that support this expression? Or any well-known technique?

SQL supports such queries (PostgreSQL):

update entity_table set booleanField = not(booleanField);

Solution

I just use native SQL queries

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>