Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DFEF21095A for ; Thu, 26 Sep 2013 08:47:25 +0000 (UTC) Received: (qmail 34424 invoked by uid 500); 26 Sep 2013 08:47:03 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 34330 invoked by uid 500); 26 Sep 2013 08:46:54 -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 34249 invoked by uid 99); 26 Sep 2013 08:46:02 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Sep 2013 08:46:02 +0000 Date: Thu, 26 Sep 2013 08:46:02 +0000 (UTC) From: "axel becker (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (OPENJPA-2431) Native-Query with multiple joins to same table returning wrong result MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2431?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] axel becker updated OPENJPA-2431: --------------------------------- Description: The resultset of the following native query should has a result of an objectarray with 3 different returnvalues. 1) TestEntityIndexReadonly: the holder entity mapped to table indexes 2) TestEntityCurrencyReadonly: currency mapped to table types 3) TestEntityTenorReadonly: tenor mapped to table types too But i get an Resultset with 3 Objects where the second and the third object are the same (same instance). 1) TestEntityIndexReadonly: 2) TestEntityCurrencyReadonly: 3) TestEntityCurrencyReadonly: The Query: Hint: For the entity-3 i get the same oid as for entity-2. The reason is, the JDBCStoreManager (Line 1031) "Object oid = base.getObjectId(this, result, null, true, null);" gets the same oid for entity-2 and entity-3. I will attache the javaclasses and mapping.xml and a screen from the wrong resultset. see also: https://issues.apache.org/jira/browse/openjpa-2218. I tried to find out a workaround by removing the abstract parent from TestEntityCurrencyReadonly and TestEntityTenorReadonly. In this case, i get the correct Objectinstances but the third entity (TestEntityTenorReadonly) holds the values from TestEntityCurrencyReadonly (also wrong)! was: The resultset of the following native query should has a result of an objectarray with 3 different returnvalues. 1) TestEntityIndexReadonly: the holder entity mapped to table indexes 2) TestEntityCurrencyReadonly: currency mapped to table types 3) TestEntityTenorReadonly: tenor mapped to table types too But i get an Resultset with 3 Objects where the second and the third object are the same (same instance). 1) TestEntityIndexReadonly: 2) TestEntityCurrencyReadonly: 3) TestEntityCurrencyReadonly: {code:title=testentityimmutable.jpa.java|borderStyle=solid} {code} Hint: For the entity-3 i get the same oid as for entity-2. The reason is, the JDBCStoreManager (Line 1031) "Object oid = base.getObjectId(this, result, null, true, null);" gets the same oid for entity-2 and entity-3. I will attache the javaclasses and mapping.xml and a screen from the wrong resultset. see also: https://issues.apache.org/jira/browse/openjpa-2218. I tried to find out a workaround by removing the abstract parent from TestEntityCurrencyReadonly and TestEntityTenorReadonly. In this case, i get the correct Objectinstances but the third entity (TestEntityTenorReadonly) holds the values from TestEntityCurrencyReadonly (also wrong)! > Native-Query with multiple joins to same table returning wrong result > --------------------------------------------------------------------- > > Key: OPENJPA-2431 > URL: https://issues.apache.org/jira/browse/OPENJPA-2431 > Project: OpenJPA > Issue Type: Bug > Components: jdbc, jpa, kernel, sql > Affects Versions: 2.1.0, 2.1.1 > Environment: Websphere 8 Runtime and ApplicationServer > Windows XP > J2EE 6 > Oracle 11 > Reporter: axel becker > Priority: Critical > Attachments: resultlist.jpeg, TestEntityCurrencyReadonly.java, testentityimmutable.jpa.xml, TestEntityIndexReadonly.java, TestEntityTenorReadonly.java, TestEntityTypeReadonly.java, TestReadonlyPrimaryKey.java > > > The resultset of the following native query should has a result of an objectarray with 3 different returnvalues. > 1) TestEntityIndexReadonly: the holder entity mapped to table indexes > 2) TestEntityCurrencyReadonly: currency mapped to table types > 3) TestEntityTenorReadonly: tenor mapped to table types too > But i get an Resultset with 3 Objects where the second and the third object are the same (same instance). > 1) TestEntityIndexReadonly: > 2) TestEntityCurrencyReadonly: > 3) TestEntityCurrencyReadonly: > The Query: > result-set-mapping="TestEntityIndexReadonly.findByDueDateResult"> > > SELECT id.*, cur.*, tenor.* > FROM indexes id > LEFT JOIN types cur ON cur.t_id = id.id_t_cur_id > LEFT JOIN types tenor ON tenor.t_id = id.id_t_tenor_id > ]]> > > > > > > > > > Hint: For the entity-3 i get the same oid as for entity-2. The reason is, the JDBCStoreManager (Line 1031) "Object oid = base.getObjectId(this, result, null, true, null);" gets the same oid for entity-2 and entity-3. > I will attache the javaclasses and mapping.xml and a screen from the wrong resultset. > see also: https://issues.apache.org/jira/browse/openjpa-2218. > I tried to find out a workaround by removing the abstract parent from TestEntityCurrencyReadonly and TestEntityTenorReadonly. > In this case, i get the correct Objectinstances but the third entity (TestEntityTenorReadonly) holds the values from TestEntityCurrencyReadonly (also wrong)! -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira