Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 18722 invoked from network); 16 Jul 2008 10:11: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:11:53 -0000 Received: (qmail 16339 invoked by uid 500); 16 Jul 2008 10:11:53 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 16313 invoked by uid 500); 16 Jul 2008 10:11: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 16295 invoked by uid 99); 16 Jul 2008 10:11: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:11: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:11:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 106AB234C15F for ; Wed, 16 Jul 2008 03:11:32 -0700 (PDT) Message-ID: <1212651166.1216203092052.JavaMail.jira@brutus> Date: Wed, 16 Jul 2008 03:11:32 -0700 (PDT) From: "Vikram Bhatia (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Created: (OPENJPA-660) ClassCastException when using OneToMany Relation and collection is subclass using Discriminator with SINGLE_TABLE strategy. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 Reporter: Vikram Bhatia 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.