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?
set t.done = (t.done==false)
– acdcjunior Jan 20 '14 at 14:52unexpected token =
near false – Aventes Jan 20 '14 at 14:59=
alone?set t.done = (t.done=false)
? Orset t.done = (t.done < 1)
orset t.done = ((t.done+0) < 1)
? – acdcjunior Jan 20 '14 at 19:36