openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Handerson <>
Subject Generic Id on MappedSupperclass
Date Wed, 31 Dec 2008 21:30:40 GMT

I have an Identifiable supper class that I want to use as a holder for Id for
my persistent subclasses. The subclasses may use a String or Long as the
primary key.

When OpenJPA tries to create the table it is mapping a Long id in my class
to a Blob field on oracle.
The query generated looks like this, note the Primary Key parenthesis is

CREATE TABLE Group (id BLOB, createdBy VARCHAR2(255), createdDateTime
TIMESTAMP, updatedBy VARCHAR2(255), updatedDateTime TIMESTAMP, name

Have anyone successfully tried this kind of mapping on OpenJPA? 

I'm migrating from Hibernate to OpenJPA and this was working using standard
JPA annotations.

I'm using OpenJPA 1.2.0 and Spring 2.5.

This is the OpenJPA Log with TRACE enabled:

2594  persistenceUnit  TRACE  [main] openjpa.MetaData - 	Resolving field
2594  persistenceUnit  TRACE  [main] openjpa.MetaData - 	"id" has mapping
strategy "org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedBlobFieldStrategy".

The Identifiable mappedSupperclass

public abstract class Identifiable&lt;T extends Serializable&gt; 
                implements Comparable, Serializable {
	private T id;
        public Identifiable() {

	public Identifiable(T id) {
		super(); = id;

	public T getId() {
		return id;

	public void setId(T id) { = id;

The Subclass

public abstract class Group extends Identifiable&lt;Long&gt; {
        String name;
        public String getName(){ return name; }
        public void setName(String name) { name; }

Any help is appreciated.
View this message in context:
Sent from the OpenJPA Users mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message