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 -937290353 INSERT INTO FRAMEWORK.SITE3 (ID, SITE_ADDRESS, SITE_NAME, ROW_VERSION) VALUES (?, ?, ?, ?) [params=(InputStream) java.io.ByteArrayInputStream@94c7f78e, (String) test, (String) test, (int) 1]} [code=-301, state=07006] The full stacktrace is available at http://pastebin.com/QFxYgzDH The identity class is a copy of https://gist.github.com/1153724 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: http://openjpa.208410.n2.nabble.com/PersistenceException-thrown-when-trying-to-persist-a-byte-array-tp7581489.html Sent from the OpenJPA Users mailing list archive at Nabble.com.