Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 19789 invoked from network); 16 Jul 2008 10:13:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jul 2008 10:13:53 -0000 Received: (qmail 19393 invoked by uid 500); 16 Jul 2008 10:13:52 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 19370 invoked by uid 500); 16 Jul 2008 10:13:52 -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 19350 invoked by uid 99); 16 Jul 2008 10:13:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 03:13:52 -0700 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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jul 2008 10:13:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C2D66234C171 for ; Wed, 16 Jul 2008 03:13:31 -0700 (PDT) Message-ID: <1768363371.1216203211797.JavaMail.jira@brutus> Date: Wed, 16 Jul 2008 03:13:31 -0700 (PDT) From: "Vikram Bhatia (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-660) ClassCastException when using OneToMany Relation and collection is subclass using Discriminator with SINGLE_TABLE strategy. In-Reply-To: <1212651166.1216203092052.JavaMail.jira@brutus> 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-660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vikram Bhatia updated OPENJPA-660: ---------------------------------- Attachment: testInheritance.zip Testcase with junit test TestCollection class. > ClassCastException when using OneToMany Relation and collection is subclass using Discriminator with SINGLE_TABLE strategy. > --------------------------------------------------------------------------------------------------------------------------- > > Key: OPENJPA-660 > URL: https://issues.apache.org/jira/browse/OPENJPA-660 > Project: OpenJPA > Issue Type: Bug > Components: jpa > Affects Versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.1.1, 1.2.0 > Reporter: Vikram Bhatia > Attachments: testInheritance.zip > > > If the entity has OneToMany relation and collection is declared as subclass which uses SINGLE_TABLE inheritance strategy, it fetches all rows irrespective of Discriminator value and throws ClassCastException. > There is entity Department having OneToMany relation with another entity FullTimeEmployee. > @OneToMany (mappedBy="dept", cascade=CascadeType.ALL) > private Collection fullTimeEmployees; > There is abstract class Employee with > @Inheritance(strategy=InheritanceType.SINGLE_TABLE) > @DiscriminatorColumn(name="TYPE") > There are two entity classes FullTimeEmployee and PartTimeEmployee which extends Employee (table emp) with Discriminator values 'F' and 'P' respectively. > Now, Support emp table contains 2 rows of PartTimeEmployee and 2 rows of FullTimeEmployee and if test class fetches Department object and calls dept.getFullTimeEmployees(), it throws ClassCastException as it gets 4 rows and doesn't use discriminator and sub class type while generating SQL query. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.