I am new in Hibernate.
When i try to inverse boolean
@Query(value = "update ToDo t set t.done= (abs(t.done -1)) where t.id=:id") public void toogleDone(@Param("id") long id);
i have this exception:
[2014-01-20 16:20:38] java.lang.ClassCastException:
java.lang.Integer cannot be cast to java.lang.Long at org.hibernate.type.descriptor.java.LongTypeDescriptor.unwrap(LongTypeDescriptor.java:36) at org.hibernate.type.descriptor.sql.BigIntTypeDescriptor$1.doBind(BigIntTypeDescriptor.java:57) ...
when i try this query:
`@Query(value = "update ToDo t set t.done= (NOT t.done) where t.id=:id")
public void toogleDone(@Param("id") long id);`
i have exception:
[2014-01-20 16:28:58] unexpected AST node: not [update org.teamdev.todo.model.domain.ToDo t set t.done= (NOT t.done) where t.id=:id]
Do you anybody have any idea to inverse boolean in HQL?
Use set t.done = (t.done=false)
, so the Query would be:
update ToDo t set t.done = (t.done=false) where t.id=:id
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments