From dev-return-5425-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Fri Aug 10 13:36:07 2007 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 98314 invoked from network); 10 Aug 2007 13:36:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Aug 2007 13:36:05 -0000 Received: (qmail 56770 invoked by uid 500); 10 Aug 2007 13:36:03 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 56739 invoked by uid 500); 10 Aug 2007 13:36:03 -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 56727 invoked by uid 99); 10 Aug 2007 13:36:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 06:36:03 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 13:36:04 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id EE6BA71418E for ; Fri, 10 Aug 2007 06:35:43 -0700 (PDT) Message-ID: <12906272.1186752943974.JavaMail.jira@brutus> Date: Fri, 10 Aug 2007 06:35:43 -0700 (PDT) From: "Kevin Sutter (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-210) Query returning 2 entities w/1-1 relationship returns wrong types in the result list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519016 ] Kevin Sutter commented on OPENJPA-210: -------------------------------------- Some of the problems identified in this Issue sound very similar to other problems that I am currently driving. I'll take a look at this Issue and see where it goes. > Query returning 2 entities w/1-1 relationship returns wrong types in the result list > ------------------------------------------------------------------------------------ > > Key: OPENJPA-210 > URL: https://issues.apache.org/jira/browse/OPENJPA-210 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 0.9.7 > Environment: 0.9.7-incubating-SNAPSHOT, windows, db2 > Reporter: George Hongell > Assignee: Kevin Sutter > Fix For: 1.0.0 > > Attachments: 1_1WrongReturnTypesBugWineryTest.zip > > > Query returning 2 entities w/1-1 relationship returns [Address, Address] instead of [Winery, Address] > "SELECT r,r.address from Winery r" returns [Address, Address] > "SELECT r,r.home from EmpBean r" returns [null, AddressBean] > does not matter if 1-1 relationship is uni-directional or bi-directional > (NOTE: "SELECT r.address,r" gets same Address id already exists in the L1 cache if uni-dir relationship (issue 209)) > clear detaches all entities from the persistent context > 1302 bugsmall TRACE [main] openjpa.Query - Executing query: SELECT r,r.home FROM EmpBean r > 1302 bugsmall TRACE [main] openjpa.jdbc.SQL - executing prepstmnt 335287292 SELECT t0.empid, t1.street, t1.city, t1.state, t1.zip FROM bugsmallEmpBean t0 LEFT OUTER JOIN bugsmallAddressBean t1 ON t0.home_street = t1.street > 1302 bugsmall TRACE [main] openjpa.jdbc.SQL - [0 ms] spent > 1302 bugsmall TRACE [main] openjpa.jdbc.SQL - executing prepstmnt 695216496 SELECT t0.city, t0.state, t0.zip FROM bugsmallAddressBean t0 WHERE t0.street = ? [params=(String) 1] > 1312 bugsmall TRACE [main] openjpa.jdbc.SQL - [10 ms] spent > java.lang.NullPointerException > at com.ibm.websphere.ejb3sample.winetour.bugsmall.BugSmallWineryTest.test_1_1relationshipQuery_EmpBean_AddressBean(BugSmallWineryTest.java:468) > at com.ibm.websphere.ejb3sample.winetour.bugsmall.BugSmallWineryTest.main(BugSmallWineryTest.java:103) > 1352 bugsmall TRACE [main] openjpa.Query - Executing query: [SELECT r,r.address FROM Winery r WHERE r.wineryid = ?1] with parameters: {1=1} > 1352 bugsmall TRACE [main] openjpa.jdbc.SQL - executing prepstmnt 1670669204 SELECT t0.wineryid, t1.phone, t1.city, t1.state, t1.street, t1.zip FROM bugsmallWinery t0 LEFT OUTER JOIN bugsmallAddress t1 ON t0.address_phone = t1.phone WHERE (t0.wineryid = ?) [params=(int) 1] > 1362 bugsmall TRACE [main] openjpa.jdbc.SQL - [10 ms] spent > 1362 bugsmall TRACE [main] openjpa.jdbc.SQL - executing prepstmnt 2097052926 SELECT t0.city, t0.state, t0.street, t0.zip FROM bugsmallAddress t0 WHERE t0.phone = ? [params=(String) 1] > 1512 bugsmall TRACE [main] openjpa.jdbc.SQL - [0 ms] spent > java.lang.ClassCastException: com.ibm.websphere.ejb3sample.winetour.bugsmall.Address incompatible with com.ibm.websphere.ejb3sample.winetour.bugsmall.Winery > at com.ibm.websphere.ejb3sample.winetour.bugsmall.BugSmallWineryTest.test_1_1relationshipQuery_Winery_Address(BugSmallWineryTest.java:374) > at com.ibm.websphere.ejb3sample.winetour.bugsmall.BugSmallWineryTest.main(BugSmallWineryTest.java:104) > close(only used for application managed Persistent Context) inactivates the EntityManager and detaches all entities > create new Application Managed Persistent Context with no managed entities > ==================================== > Starting test_1_1relationshipQuery_EmpBean_AddressBean() > ==================================== > Shows a EmpBean and its address > String sql = "SELECT r,r.home FROM EmpBean r WHERE r.empid = ?1" > Caution: requires _em.find(EmpBean.class,parm1) to avoid cache exception or incorrect types in result list > Caution: "SELECT r,r.home" currently fails, returns [null, AddressBean] instead of [EmpBean, AddressBean] > ----------------------------------------------------------------------------- > 1-1 query oa[0] is null > 1-1 query oa[1] = com.ibm.websphere.ejb3sample.winetour.bugsmall.AddressBean > ==================================== > Starting test_1_1relationshipQuery_Winery_Address() > ==================================== > Shows a winery and its address > String sql = "SELECT r,r.address FROM Winery r WHERE r.wineryid = :wineryid " > Caution: requires _em.find(Winery.class,parm1) to avoid cache exception or incorrect types in result list > Caution: "SELECT r,r.address" currently fails, returns [Address, Address] instead of [Winery, Address] > ----------------------------------------------------------------------------- > 1-1 query oa[0] = com.ibm.websphere.ejb3sample.winetour.bugsmall.Address > 1-1 query oa[1] = com.ibm.websphere.ejb3sample.winetour.bugsmall.Address -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.