openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Holding <>
Subject PersistenceException thrown when trying to persist a byte array
Date Mon, 22 Oct 2012 17:30:22 GMT
I have a requirement to read and write records using OpenJPA to a table in a
DB2 database where the primary key is a UUID stored in a column defined as
"char(16) bit for data".

The JPA entity class for the entity I'm trying to persist references an
identity class which contains the byte array that will be used for the
primary key. However whenever I try to persist the record to the table DB2
returns the error:

Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The value of
input variable, expression or parameter number "1" cannot be used because of
its data type.. SQLCODE=-301, SQLSTATE=07006, DRIVER=3.63.123 {prepstmnt
ROW_VERSION) VALUES (?, ?, ?, ?) [params=(InputStream), (String) test, (String) test, (int)
1]} [code=-301, state=07006]

The full stacktrace is available at

The identity class is a copy of

After a bit of Google searching I've found JIRA OPENJPA-922 which has a very
similar error message, although it says the fix was applied in OpenJPA
version 2.0.0-M3 whilst I'm running a later version of OpenJPA.

The entity class and identity class are part of an EJB which is running on
WebSphere version 8.5 using the version of OpenJPA provided by the container
which I believe is 2.2.1.

Would someone please be able to confirm whether I should be able to write a
byte array containing a UUID into a table in a DB2 database where the column
is defined as "char(16) bit for data" using OpenJPA and if so, suggest where
I'm going wrong as I can't see how to resolve this problem?

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message