openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "B.J. Reed (JIRA)" <>
Subject [jira] Closed: (OPENJPA-289) Setting a parameter in a bulk update with a value of type Enum throws an exception
Date Mon, 23 Mar 2009 17:49:50 GMT


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/
 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:
>             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(
>        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
>        at com.softek.jpa.ShapeHelper.main(
> 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.

View raw message