Hello there,
At first I'd like to to note: I am a newbie in a hibernate world!
So, here is my current problem: I want to update my entities. When I change simple data, such as text or numbers - it works flawless
Code:
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaUpdate<ManualDue> query = cb.createCriteriaUpdate(ManualDue.class);
Root<ManualDue> root = query.from(ManualDue.class);
query.set(ManualDue_.duesValue, cb.sum(root.get(ManualDue_.duesValue),amount));
entityManager.createQuery(query).executeUpdate();
If I try to set some sort of objects, I encounter unexpected issues:
Code:
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaUpdate<ManualDue> query = cb.createCriteriaUpdate(ManualDue.class);
Root<ManualDue> root = query.from(ManualDue.class);
query.set(ManualDue_.unionDuesReason, OrikaUtility.convertObject(mapper, reason, UnionDuesReason.class));
entityManager.createQuery(query).executeUpdate();
17:47:33,863 ERROR ErrorCounter:76 - line 1:133: unexpected token: =
17:47:33,873 ERROR ErrorCounter:71 - line 1:133: unexpected token: =
line 1:133: unexpected token: =
at org.hibernate.hql.internal.antlr.HqlBaseParser.updateStatement(HqlBaseParser.java:251)
....
java.lang.IllegalArgumentException: node to traverse cannot be null!
at org.hibernate.hql.internal.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:63)
...
What am I doing wrong?