Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 22010 invoked from network); 27 Feb 2010 00:25:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Feb 2010 00:25:55 -0000 Received: (qmail 53473 invoked by uid 500); 27 Feb 2010 00:25:45 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 53448 invoked by uid 500); 27 Feb 2010 00:25:45 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 53440 invoked by uid 99); 27 Feb 2010 00:25:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Feb 2010 00:25:45 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 216.139.236.158 is neither permitted nor denied by domain of nabble@reider.net) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Feb 2010 00:25:37 +0000 Received: from jim.nabble.com ([192.168.236.80]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NlAUe-0005ff-DA for users@openjpa.apache.org; Fri, 26 Feb 2010 16:25:16 -0800 Date: Fri, 26 Feb 2010 16:25:16 -0800 (PST) From: Tradingfours To: users@openjpa.apache.org Message-ID: <1267230316403-4642827.post@n2.nabble.com> In-Reply-To: <1267202108062-4640216.post@n2.nabble.com> References: <7da10e7d1002241852l7d1cb3dfs89a92959ee263409@mail.gmail.com> <185274.60372.qm@web55903.mail.re3.yahoo.com> <504732.18167.qm@web55902.mail.re3.yahoo.com> <1267172998721-4637794.post@n2.nabble.com> <002601cab6c5$bc42afe0$34c80fa0$@com> <1267202108062-4640216.post@n2.nabble.com> Subject: RE: JPA adding class name to join column name MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org typos corrected: If a subclass of an entity using SINGLE_TABLE inheritance and which specifies @SecondaryTable(SEC_TBL), contains a @Column(table="SEC_TBL",name="...") then a find(subclass.class,pk) results in 'INNER JOIN PRI_TABLE on PRI_TABLE.id = SEC_TBL.subclass_ID' where 'subclass_ID' is not in the table, and should simply be 'ID'. For example: @Entity @Table(name="CUSTOMERTYPE") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @SecondaryTable(name="CUSTOMERDATA",pkJoinColumns = @PrimaryKeyJoinColumn (name="ID" , referencedColumnName="ID")) @DiscriminatorColumn(name="ROLE",length=4) public class CustomerClass extends EntityImpl implements Serializable { @Id @Column(name="ID") protected String id; } @Entity @DiscriminatorValue(value="0010") public class ValuedCustomerClass extends CustomerClass implements Serializable { @Column(table="CUSTOMERDATA", name="NAME") private String name; } find(CustomerClass.class,aValuedCustomerPK) org.apache.openjpa.persistence.PersistenceException: DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703, SQLERRMC: T1.VALUEDCUSTOMERCLASS_ID SELECT t0.ROLE, t1.NAME FROM CUSTOMERTYPE t0 INNER JOIN CUSTOMERDATA t1 ON t0.ID = t1.VALUEDCUSTOMERCLASS_ID <<< should be t1.ID -- View this message in context: http://n2.nabble.com/JPA-adding-class-name-to-join-column-name-tp4630454p4642827.html Sent from the OpenJPA Users mailing list archive at Nabble.com.