ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <nathan.ma...@gmail.com>
Subject Re: Returning child class as base class
Date Wed, 19 Aug 2009 19:45:24 GMT
Check out the discriminator tag on page 38 of the new ibatis 3.0 user guide.

On Wed, Aug 19, 2009 at 1:08 PM, <Scott.Smith2@l-3com.com> wrote:

>  I am wondering if there is a way to use iBatis to perform a query that
> will return multiple child classes as the base class.  Here is a simplified
> example of the situation:
>
>
>
> ·         Working in Java 1.6 with iBatis 2.3 and postgreSQL 8.3
>
> ·         I have a base class Product with child classes PhysicalProduct
> and ElectronicProduct.
>
> ·         I have result maps for both child classes, and various queries
> to return lists of each type.  For simplicity, just consider two select
> statements: selectAllElectronic (returns List<ElectronicProduct>) and
> selectAllPhysical (returns List<PhysicalProduct>)
>
> ·         I want to define a query (selectAllProducts) that will return a
> combined list of both Physical and Electronic products as a List<Product>.
> I can clearly do this in java code by invoking each query in succession and
> combining the results.  Is there a way to do the equivalent within the sql
> map?
>
>
>

Mime
View raw message