Search code examples
javaoracle-databasewebsphereopenjpa

OpenJPA: Mapping Oracle RAW column


We have a RAW column in one of our Oracle databases.

As far as we have seen in other projects it should be possible to map this column to a String property.

@Column(name = "MYFIELD")
private String myfield;

It works with Spring but in WebSphere 7 we get the following error:

<openjpa-1.2.3-SNAPSHOT-r422266:1372550 fatal user error> org.apache.openjpa.persistence.ArgumentException: "mypackage.MyClass.myfield" declares a column that is not compatible with the expected type "varchar".  Column details:
Full Name: MYTABLE.MYFIELD
Type: varbinary
Size: 50
Default: null
Not Null: true

What is going wrong? We have seen this working in WebSphere as well.


Solution

  • In the end, we had to remove the following line from the persistence.xml file:

      <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>