From dev-return-16435-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Fri May 14 02:16:45 2010 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 555 invoked from network); 14 May 2010 02:16:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 May 2010 02:16:45 -0000 Received: (qmail 93603 invoked by uid 500); 14 May 2010 02:16:45 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 93543 invoked by uid 500); 14 May 2010 02:16:44 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 93535 invoked by uid 99); 14 May 2010 02:16:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 May 2010 02:16:44 +0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 May 2010 02:16:37 +0000 Received: from jim.nabble.com ([192.168.236.80]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OCkRj-0005yx-Pa for dev@openjpa.apache.org; Thu, 13 May 2010 19:16:15 -0700 Date: Thu, 13 May 2010 19:16:15 -0700 (PDT) From: atanamir To: dev@openjpa.apache.org Message-ID: <1273803375787-5049201.post@n2.nabble.com> Subject: Generics Support MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi devs, I'd like to start work on adding generics support into OpenJPA. Specifically, I'd like to allow the following: @MappedSuperclass public class Identifiable { private T id; @Id public T getId() { return id; } private void setId(T i) { id = i; } } @Entity public class Concrete extends Identifiable { ... } @Entity public class CompoundConcrete extends Identifiable { @Embeddable 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? Thanks, atanamir -- View this message in context: http://openjpa.208410.n2.nabble.com/Generics-Support-tp5049201p5049201.html Sent from the OpenJPA Developers mailing list archive at Nabble.com.