Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 98923 invoked from network); 11 Feb 2011 22:31:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Feb 2011 22:31:21 -0000 Received: (qmail 35020 invoked by uid 500); 11 Feb 2011 22:31:21 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 34960 invoked by uid 500); 11 Feb 2011 22:31:20 -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 34952 invoked by uid 99); 11 Feb 2011 22:31:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Feb 2011 22:31:20 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Feb 2011 22:31:18 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 8F1721A0C65 for ; Fri, 11 Feb 2011 22:30:57 +0000 (UTC) Date: Fri, 11 Feb 2011 22:30:57 +0000 (UTC) From: "Michael Dick (JIRA)" To: dev@openjpa.apache.org Message-ID: <791195620.11766.1297463457566.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <7792970.116011294084185776.JavaMail.jira@thor> Subject: [jira] Commented: (OPENJPA-1912) enhancer generates invalid code if fetch-groups is activated 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-1912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12993736#comment-12993736 ] Michael Dick commented on OPENJPA-1912: --------------------------------------- You're right. I thought it only checked when the PCEnhancer was executed, but after looking at the code it's the MetaDataRepository that triggers the check. > enhancer generates invalid code if fetch-groups is activated > ------------------------------------------------------------ > > Key: OPENJPA-1912 > URL: https://issues.apache.org/jira/browse/OPENJPA-1912 > Project: OpenJPA > Issue Type: Bug > Components: Enhance > Affects Versions: 2.0.0, 2.0.1, 2.1.0 > Reporter: Mark Struberg > Priority: Critical > Attachments: OPENJPA-1912-enhancer.patch, OPENJPA-1912-fix-wo_cleanup-2.patch, OPENJPA-1912-fix-wo_cleanup.patch, OPENJPA-1912-mdd.diff.txt, OPENJPA-1912-test.patch > > > If openjpa.DetachState =fetch-groups is used, the enhancer will add a 'implements Externalizable' + writeExternal + readExternal. > The problem is, that writeExternal and readExternal will also try to externalize the private members of any given superclass. Thus we get a runtime Exception that we are not allowed to access those fields. > Example: > @Entity > public abstract class AbstractGroup { > ... > @Temporal(TemporalType.TIMESTAMP) > @TrackChanges > private Date applicationBegin; > ... > } > and > @Entity > public class Group extends AbstractGroup { > ... > } > will result in the following code (decompiled with jad): > public void writeExternal(ObjectOutput objectoutput) > throws IOException > { > pcWriteUnmanaged(objectoutput); > if(pcStateManager != null) > { > if(pcStateManager.writeDetached(objectoutput)) > return; > } else > { > objectoutput.writeObject(pcGetDetachedState()); > objectoutput.writeObject(null); > } > objectoutput.writeObject(applicationBegin); > objectoutput.writeObject(applicationEnd); > objectoutput.writeObject(applicationLocked); > objectoutput.writeObject(approvalRequired); > ... -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira