openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Defoy" <>
Subject Bulk update with Enums
Date Fri, 20 Jul 2007 14:07:14 GMT

I am trying to do a bulk update on entities to set an attribute.  This
attribute is an enum.  If I put the enum in the update statement as in
the following:

UPDATE Shape s SET s.type = :type WHERE = :id

and I set the "type" parameter with:

query.setParameter( "type", ShapeType.SQUARE );

I get the following error message:

Exception in thread "main" <0.9.7-incubating nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: The specified
parameter of type "class test.ShapeType" is not a valid query
	at org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown(
	at org.apache.openjpa.jdbc.sql.SQLBuffer.setParameters(
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(
	at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeBulkOperation(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeUpdate(
	at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeUpdate(
	at org.apache.openjpa.kernel.QueryImpl.update(
	at org.apache.openjpa.kernel.QueryImpl.execute(
	at org.apache.openjpa.kernel.QueryImpl.updateAll(
	at org.apache.openjpa.kernel.DelegatingQuery.updateAll(
	at org.apache.openjpa.persistence.QueryImpl.executeUpdate(
	at com.softek.jpa.ShapeHelper.testShapeUpdate(
	at com.softek.jpa.ShapeHelper.main(

If instead I try to set the parameter with the ordinal value, it works fine.

Is it normal or is there something I am doing wrong?

Thanks in advance!


View raw message