[ https://issues.apache.org/jira/browse/OPENJPA-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] B.J. Reed closed OPENJPA-289. ----------------------------- Resolution: Fixed Fix Version/s: 1.1.0 This issue was fixed for the 1.1 release of OpenJPA. A test case was written and I have verified that it works then and continues to work in trunk today. The test case is the "testEnumParamInSetInUpdate()" test case that can be found in openjpa-persistence-jdbc org/apache/openjpa/persistence/fields/TestEnumsInJPQL.java. Please reopen if you continue to see a similar problem after this version of OpenJPA. > Setting a parameter in a bulk update with a value of type Enum throws an exception > ---------------------------------------------------------------------------------- > > Key: OPENJPA-289 > URL: https://issues.apache.org/jira/browse/OPENJPA-289 > Project: OpenJPA > Issue Type: Sub-task > Affects Versions: 0.9.7 > Environment: Windows XP SP2, Java 1.5.0_11, Hypersonic database (hsqldb) 1.8.4 > Reporter: Christian Defoy > Fix For: 1.1.0 > > > Assume that Class Shape contains an attribute of type LineType (an Enum). When trying to do a bulk update of the enum value using the following query > UPDATE Shape s SET s.type = :type > and setting the "type" parameter using the following: > query.setParameter( "type", Type.PLAIN ); > the following exception is thrown: > Exception in thread "main" <0.9.7-incubating nonfatal user error> org.apache.openjpa.persistence.ArgumentException: The specified parameter of type "class test.LineType" 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) > There is a workaround: assuming that the database column is an integer, you can use the ordinal value of the enum. This also assumes that the values of your enums are in sync with their ordinal values. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.