Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 41677 invoked from network); 28 Oct 2009 14:49:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Oct 2009 14:49:30 -0000 Received: (qmail 58088 invoked by uid 500); 28 Oct 2009 14:49:30 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 58016 invoked by uid 500); 28 Oct 2009 14:49:29 -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 58006 invoked by uid 99); 28 Oct 2009 14:49:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Oct 2009 14:49:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Oct 2009 14:49:20 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5ED25234C045 for ; Wed, 28 Oct 2009 07:48:59 -0700 (PDT) Message-ID: <491372389.1256741339373.JavaMail.jira@brutus> Date: Wed, 28 Oct 2009 14:48:59 +0000 (UTC) From: "Matthew T. Adams (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-1361) Enhancer fails when using OneToMany.mappedBy on bidi one-to-many relationship when using interface references on many side In-Reply-To: <369187535.1256320439393.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1361?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Matthew T. Adams updated OPENJPA-1361: -------------------------------------- Attachment: case-sandbox-property-access.zip At the suggestion of Mike Dick (http://n2.nabble.com/Using-mappedBy-getting-not-a-valid-inverse-relation-tt3880282.html#a3903117), tried property-based access & annotating the interface member with @OneToMany. Got correct schema, but can't persist concrete type implementing interface, getting error: org.apache.openjpa.persistence.EntityExistsException: Attempt to persist detached object "example.model.Concrete@81fb". If this is a new instance, make sure any version and/or auto-generated primary key fields are null/default when persisting. FailedObject: example.model.Concrete@81fb Doesn't matter anyway, since property access is neither desirable nor an option. > Enhancer fails when using OneToMany.mappedBy on bidi one-to-many relationship when using interface references on many side > -------------------------------------------------------------------------------------------------------------------------- > > Key: OPENJPA-1361 > URL: https://issues.apache.org/jira/browse/OPENJPA-1361 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 1.2.1 > Reporter: Matthew T. Adams > Attachments: case-sandbox-property-access.zip, case-sandbox.zip > > > Synopsis: bidirectional one-to-many relationship where the one side references the objects on the many side using a concrete class reference and the many side references the object on the one side using an interface reference. When specifying the mappedBy property of the @OneToMany annotation, the OpenJPA enhancer throws the error: > Collection field "example.model.Concrete.pebbles" declares that it is mapped by "example.model.Pebble.buildingMaterial", but this is not a valid inverse relation. > When I remove the mappedBy property, everything works fine, except that OpenJPA creates an extra join table (Concrete_Pebble) where it shouldn't, IMHO. I have two questions, an answer to either one of which will suffice: > 1. Why can't I use mappedBy in this scenario? > 2. How do I annotate things with @JoinColumn or similar that will allow me to not have a join table and only the reference from Pebble back to its BuildingMaterial? > I'll attach test case next. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.