Christian-
Is it normal or is there something I am doing wrong?
It is definitely a bug. Could you make a report at https://
issues.apache.org/jira/browse/OPENJPA ?
On Jul 20, 2007, at 7:07 AM, Christian Defoy wrote:
Hi,
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 s.id = :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
parameter.
at org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown
(DBDictionary.java:1275)
at org.apache.openjpa.jdbc.sql.SQLBuffer.setParameters
(SQLBuffer.java:567)
at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement
(SQLBuffer.java:478)
at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement
(SQLBuffer.java:454)
at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement
(SQLBuffer.java:443)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeBulkOperation
(JDBCStoreQuery.java:500)
at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeUpdate
(JDBCStoreQuery.java:430)
at org.apache.openjpa.kernel.ExpressionStoreQuery
$DataStoreExecutor.executeUpdate(ExpressionStoreQuery.java:690)
at org.apache.openjpa.kernel.QueryImpl.update(QueryImpl.java:1036)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:843)
at org.apache.openjpa.kernel.QueryImpl.updateAll(QueryImpl.java:879)
at org.apache.openjpa.kernel.DelegatingQuery.updateAll
(DelegatingQuery.java:581)
at org.apache.openjpa.persistence.QueryImpl.executeUpdate
(QueryImpl.java:313)
at com.softek.jpa.ShapeHelper.testShapeUpdate(ShapeHelper.java:180)
at com.softek.jpa.ShapeHelper.run(ShapeHelper.java:78)
at com.softek.jpa.ShapeHelper.main(ShapeHelper.java:196)
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!
Christian