I'm trying to use the JDOQL bulk update in datanucleus, but I get the following exception,
12/08/13 13:06:56 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored 12/08/13 13:06:56 INFO DataNucleus.Persistence: ================= Persistence Configuration =============== 12/08/13 13:06:56 INFO DataNucleus.Persistence: DataNucleus Persistence Factory - Vendor: "DataNucleus" Version: "2.2.5" 12/08/13 13:06:56 INFO DataNucleus.Persistence: DataNucleus Persistence Factory initialised for datastore URL="jdbc:derby:;databaseName=metastore_db;create=true" driver="org.apache.derby.jdbc.EmbeddedDriver" userName="APP" 12/08/13 13:06:56 INFO DataNucleus.Persistence: =========================================================== 12/08/13 13:06:57 INFO Datastore.Schema: Initialising Catalog "", Schema "APP" using "None" auto-start option 12/08/13 13:06:57 INFO Datastore.Schema: Catalog "", Schema "APP" initialised - managing 0 classes 12/08/13 13:06:57 INFO DataNucleus.MetaData: Registering listener for metadata initialisation
Query to be executed: UPDATE myDomain.MTable t SET t.tableName = 'tmp3' WHERE t.tableName == 'tmp' 12/08/13 13:06:57 INFO DataNucleus.JDO: Exception thrown JPQL UPDATE query has no update clause! Query should be like "UPDATE Entity e SET e.param = new_value WHERE [where-clause]" org.datanucleus.exceptions.NucleusUserException: JPQL UPDATE query has no update clause! Query should be like "UPDATE Entity e SET e.param = new_value WHERE [where-clause]" at org.datanucleus.query.JDOQLSingleStringParser$Compiler.compileUpdate(JDOQLSingleStringParser.java:236) at org.datanucleus.query.JDOQLSingleStringParser$Compiler.compileSelect(JDOQLSingleStringParser.java:160) at org.datanucleus.query.JDOQLSingleStringParser$Compiler.compile(JDOQLSingleStringParser.java:125) at org.datanucleus.query.JDOQLSingleStringParser$Compiler.access$000(JDOQLSingleStringParser.java:114) at org.datanucleus.query.JDOQLSingleStringParser.parse(JDOQLSingleStringParser.java:106) at org.datanucleus.store.query.AbstractJDOQLQuery.(AbstractJDOQLQuery.java:108) at org.datanucleus.store.rdbms.query.JDOQLQuery.(JDOQLQuery.java:119) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:597) at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:324) at org.datanucleus.store.query.QueryManager.newQuery(QueryManager.java:264) at org.datanucleus.jdo.JDOPersistenceManager.newQuery(JDOPersistenceManager.java:1272)
I'm using DN-core-2.2.4, DN-RDBMS-2.2.4, DN-Enhancer-2.1.3 and DN-ConnectionPool-2.0.3.
The code snippet that I fires the update is as follows,
openTransaction();
Query q = pm.newQuery("javax.jdo.query.JDOQL", query);
q.compile();
Collection<?> result = (Collection<?>) q.execute();
committed = commitTransaction();
Any pointers on what I'm doing wrong.
My query is of the form "UPDATE myDomain.A t SET t.tableName = 'tmp3' WHERE t.tableName == 'tmp'"