I have a named query like this:

UPDATE Table t SET t.status = :statusTo, t.something = null 
WHERE t.status = :statusFrom AND t.lastStatusUpdate <= :lastStatusUpdate

This query works perfectly fine when I run it in SQL Developer, but not when my application tries to run it. Before executing the query the 3 parameters are set ofcourse. I get the following error when my application runs it:

org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing 
the query filter "query here". Error message: Expression "UPDATEVALUE" requires
at least one child.;

While google'ing my problem, the only result that more or less was the same as my situation was a bug report from almost 6 years ago, where updating to a null value didn't work. That page mentions that it should be resolved, and my OpenJPA version should be more recent.

OpenJPA version is 1.2.1

有帮助吗?

解决方案

The error message kind of threw me in the wrong direction at first. The problem was indeed the "= null" part of the query.

I fixed the query like this:

t.something = :something

And then the parameter like this:

query.setParameter("something", null);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top