From dev-return-17398-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Mon Sep 20 15:32:58 2010 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 56493 invoked from network); 20 Sep 2010 15:32:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Sep 2010 15:32:58 -0000 Received: (qmail 43978 invoked by uid 500); 20 Sep 2010 15:32:57 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 42934 invoked by uid 500); 20 Sep 2010 15:32:55 -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 42279 invoked by uid 99); 20 Sep 2010 15:32:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Sep 2010 15:32:54 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Sep 2010 15:32:54 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o8KFWWUo008686 for ; Mon, 20 Sep 2010 15:32:33 GMT Message-ID: <33328766.296111284996752549.JavaMail.jira@thor> Date: Mon, 20 Sep 2010 11:32:32 -0400 (EDT) From: "Rick Curtis (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1804) NPE in MappingInfo.java line 1514 In-Reply-To: <7307874.276561284839673337.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-1804?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12= 912499#action_12912499 ]=20 Rick Curtis commented on OPENJPA-1804: -------------------------------------- Willis - When you ran with the standalone enhancer was the error/exception that you = encountered? Was it helpful to figure out what was wrong? Just to warn you, I'd highly recommend staying away from the runtime enhanc= er... you'll find numerous documented(and undocumented) issues. I'd say the= support is half baked at best. Thanks, Rick > NPE in MappingInfo.java line 1514 > --------------------------------- > > Key: OPENJPA-1804 > URL: https://issues.apache.org/jira/browse/OPENJPA-1804 > Project: OpenJPA > Issue Type: Bug > Components: Enhance > Affects Versions: 2.0.1 > Reporter: Willis Blackburn > > I am encountering a NPE at MappingInfo.java line 1514. I'm sorry I don't= have time to prepare a test case right now. I'm not even 100% sure what i= s causing the problem, but it seems to be something like this: > I have classes Organization, Group, User, and AddressBook. > Group has a reference (many-to-one) to Organization. > I'm using field-level access and the Java 6 runtime enhancer. (NOT the b= uild-time enhancer or the agent.) > In ManagedClassSubclasser.prepareUnenhancedClasses, the code receives a l= ist of Class objects--the ones in persistence.xml. They are not in the sam= e order as they are in persistence.xml, but I don't know if that's importan= t. The first one is Group. During the processing of Group, the code invok= es ClassMapping.setTable to set the table name, which is "group_table." Th= is comes from the @Table annotation of Group. So far, so good. Then the c= ode does some additional processing on the relationship mappings of Group, = which include the reference to Organization. During the processing of that= relationship, the code calls MappingInfo.mergeJoinColumn. On line 1367, t= he method calls rel.getTable. The "rel" variable points to the ClassMappin= g for Organization. Remember that prepareUnenhancedClasses hasn't gotten t= o Organization yet--it's still working on Group--and so I assume that this = Organization mapping was created on-demand. However, rel.getTable returns = null. The Organization class has a @Table attribute, and I can see that th= e table name has been loaded in the ClassMappingInfo instance attached to t= he ClassMapping for Organization, however the table name has not yet been c= opied from ClassMappingInfo to ClassMapping. Later, the mergeJoinColumn me= thod attempts to dereference the null table name and generates the NPE. > Bottom line: When using the Java 6, runtime enhancer, if class A has a r= eference to class B, and both classes have @Table annotations (at least), a= nd class A is processed first, then it produces a NPE. --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.