byte[] as primary key with Oracle

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

byte[] as primary key with Oracle

I'm trying to use a very simple key/value table, where both the key and the
value are byte arrays. The key is limited to 64 bytes length, the value can
be a lot bigger (I'm using a blob for that).
I've read documentation and googled for two days now but I haven't found a
working solution that is working on Oracle (Oracle 18c xe, ojdbc8). I've got
something working on Postgres, but I cannot get this working on Oracle.
What is the recommended data type in Oracle and how do I tell OpenJPA what
the data type in Oracle is, e.g. what annotations/properties do I have to

The error that I'm getting is "Caused by:
org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-00932: inconsistent
datatypes: expected - got BLOB"

Here is the class:

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;

public class Store {
  private byte[] key;
  private byte[] value;

  public byte[] getKey() {
    return key;

  public byte[] getValue() {
    return value;

  public void setKey(final byte[] key) {
    this.key = key;

  public void setValue(final byte[] value) {
    this.value = value;

Thanks for your help!

Sent from: