openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atanamir <>
Subject Generics Support
Date Fri, 14 May 2010 02:16:15 GMT

Hi devs,

I'd like to start work on adding generics support into OpenJPA. 
Specifically, I'd like to allow the following:

public class Identifiable<T> {
  private T id; 

  public T getId() { return id; }
  private void setId(T i) { id = i; }

public class Concrete extends Identifiable<Integer> {

public class CompoundConcrete extends Identifiable<CompoundConcrete.PK> {
  protected static class PK {

Currently, for example, the code fails when trying to get the metadata for
Concrete because it believes that Id is of type java.lang.Object, which "is
not a persistent type".  This is because the getReturnType() method in
java.reflection.Method returns java.lang.Object if the return type is a
generic; additional API calls must be used.

>From my searches I've not found a precise bug that matches this exact
problem, but I've found several other bugs related to generics that have not
been assigned to anyone yet.  Hopefully, I'll be able to fix all the
generics-related bugs.  

With this in mind, is there any potential problems I should be aware of
before attempting to hack at the code?  Anything you guys can foresee that
makes generics impossible?  From what I've read, nothing in the JPA spec
refers to generics directly at all; but since Generics is a compile-time
transformation, I don't see why it shouldn't work with JPA/OpenJPA.  

Shall I open a bug with this exact problem also, before I get going?

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

View raw message