You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Paul Benedict <pa...@yahoo.com> on 2005/11/18 07:29:29 UTC

Nested Result Sets with inner joins (important!)

Clinton,

One of the most disappointing aspects of IBATIS has to be the inability to reuse result maps for
nested properties. IBATIS only allows me to use them if I [1] use another select or [2] use a
collection. I get this error every time:

"Error instantiating collection property for mapping 'apple'."

I ask this because sometimes I need to do joins for efficiency and want to reuse my resultMap to
populate my inner objects. The user guide talks about how we can use the nested notation to get
this done, but it's too much work to list out all the properties again. I would love to see
something like this come along soon:

<resultMap id="fruitMap" class="TootyFruity">
  <result property="apple" resultMap="appleMap"/>
  <result property="orange" resultMap="orangeMap"/>
</resultMap>

<resultMap id="appleMap" class="Apple">
  <result property="id" column="id"/>
  <result property="name" column="name"/>
</resultMap>

This way I can write a select to populate "fruitMap" that joins to APPLE and ORANGE and use my
existing maps for them to populate them as children of TootyFruit. --Gotta love the names!

What do you think? This is very important to me. Hibernate can do this, why can't we?

Thanks!
Paul


		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs

Re: Nested Result Sets with inner joins (important!)

Posted by Paul Benedict <pa...@yahoo.com>.
My apologies to all on the IBATIS forum.... :-) My habitual use of "but Hibernate can do this" is
not an endorsement of Hibernate, but merely a statement that I use Hibernate at work and am
familiar with its feature set. There are some things it can do which I would like IBATIS to do
also, but there's also many things IBATIS can do which Hibernate cannot -- such as humility, for
one :) Thanks for the mild correction.

--- Clinton Begin <cl...@gmail.com> wrote:

> That's something we can definitely do.
> 
> But please do me a favour....don't use the "Hibernate can do this" as a
> supporting argument. It's weak and is akin to after-school fights.
> 
> Hibernate is a very different product and the XML configuration goals are
> almost impossible to compare in any way that is sensible.
> 
> Cheers,
> Clinton
> 
> 
> On 11/18/05, Jeff Butler <je...@gmail.com> wrote:
> >
> > Wow - synchronicity. This is the same as IBATIS-225 (just filed). I agree
> > that this should be fixed/enhanced. There are some issues, but we should be
> > able to overcome them.
> >  Jeff Butler
> >
> >  On 11/18/05, Paul Benedict <paul4christ79@yahoo.com > wrote:
> > >
> > > Clinton,
> > >
> > > One of the most disappointing aspects of IBATIS has to be the inability
> > > to reuse result maps for
> > > nested properties. IBATIS only allows me to use them if I [1] use
> > > another select or [2] use a
> > > collection. I get this error every time:
> > >
> > > "Error instantiating collection property for mapping 'apple'."
> > >
> > > I ask this because sometimes I need to do joins for efficiency and want
> > > to reuse my resultMap to
> > > populate my inner objects. The user guide talks about how we can use the
> > > nested notation to get
> > > this done, but it's too much work to list out all the properties again.
> > > I would love to see
> > > something like this come along soon:
> > >
> > > <resultMap id="fruitMap" class="TootyFruity">
> > > <result property="apple" resultMap="appleMap"/>
> > > <result property="orange" resultMap="orangeMap"/>
> > > </resultMap>
> > >
> > > <resultMap id="appleMap" class="Apple">
> > > <result property="id" column="id"/>
> > > <result property="name" column="name"/>
> > > </resultMap>
> > >
> > > This way I can write a select to populate "fruitMap" that joins to APPLE
> > > and ORANGE and use my
> > > existing maps for them to populate them as children of TootyFruit.
> > > --Gotta love the names!
> > >
> > > What do you think? This is very important to me. Hibernate can do this,
> > > why can't we?
> > >
> > > Thanks!
> > > Paul
> > >
> > >
> > >
> > > __________________________________
> > > Start your day with Yahoo! - Make it your home page!
> > > http://www.yahoo.com/r/hs
> > >
> >
> >
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

Re: Nested Result Sets with inner joins (important!)

Posted by Clinton Begin <cl...@gmail.com>.
That's something we can definitely do.

But please do me a favour....don't use the "Hibernate can do this" as a
supporting argument. It's weak and is akin to after-school fights.

Hibernate is a very different product and the XML configuration goals are
almost impossible to compare in any way that is sensible.

Cheers,
Clinton


On 11/18/05, Jeff Butler <je...@gmail.com> wrote:
>
> Wow - synchronicity. This is the same as IBATIS-225 (just filed). I agree
> that this should be fixed/enhanced. There are some issues, but we should be
> able to overcome them.
>  Jeff Butler
>
>  On 11/18/05, Paul Benedict <paul4christ79@yahoo.com > wrote:
> >
> > Clinton,
> >
> > One of the most disappointing aspects of IBATIS has to be the inability
> > to reuse result maps for
> > nested properties. IBATIS only allows me to use them if I [1] use
> > another select or [2] use a
> > collection. I get this error every time:
> >
> > "Error instantiating collection property for mapping 'apple'."
> >
> > I ask this because sometimes I need to do joins for efficiency and want
> > to reuse my resultMap to
> > populate my inner objects. The user guide talks about how we can use the
> > nested notation to get
> > this done, but it's too much work to list out all the properties again.
> > I would love to see
> > something like this come along soon:
> >
> > <resultMap id="fruitMap" class="TootyFruity">
> > <result property="apple" resultMap="appleMap"/>
> > <result property="orange" resultMap="orangeMap"/>
> > </resultMap>
> >
> > <resultMap id="appleMap" class="Apple">
> > <result property="id" column="id"/>
> > <result property="name" column="name"/>
> > </resultMap>
> >
> > This way I can write a select to populate "fruitMap" that joins to APPLE
> > and ORANGE and use my
> > existing maps for them to populate them as children of TootyFruit.
> > --Gotta love the names!
> >
> > What do you think? This is very important to me. Hibernate can do this,
> > why can't we?
> >
> > Thanks!
> > Paul
> >
> >
> >
> > __________________________________
> > Start your day with Yahoo! - Make it your home page!
> > http://www.yahoo.com/r/hs
> >
>
>

Re: Nested Result Sets with inner joins (important!)

Posted by Jeff Butler <je...@gmail.com>.
Wow - synchronicity. This is the same as IBATIS-225 (just filed). I agree
that this should be fixed/enhanced. There are some issues, but we should be
able to overcome them.
 Jeff Butler

 On 11/18/05, Paul Benedict <pa...@yahoo.com> wrote:
>
> Clinton,
>
> One of the most disappointing aspects of IBATIS has to be the inability to
> reuse result maps for
> nested properties. IBATIS only allows me to use them if I [1] use another
> select or [2] use a
> collection. I get this error every time:
>
> "Error instantiating collection property for mapping 'apple'."
>
> I ask this because sometimes I need to do joins for efficiency and want to
> reuse my resultMap to
> populate my inner objects. The user guide talks about how we can use the
> nested notation to get
> this done, but it's too much work to list out all the properties again. I
> would love to see
> something like this come along soon:
>
> <resultMap id="fruitMap" class="TootyFruity">
> <result property="apple" resultMap="appleMap"/>
> <result property="orange" resultMap="orangeMap"/>
> </resultMap>
>
> <resultMap id="appleMap" class="Apple">
> <result property="id" column="id"/>
> <result property="name" column="name"/>
> </resultMap>
>
> This way I can write a select to populate "fruitMap" that joins to APPLE
> and ORANGE and use my
> existing maps for them to populate them as children of TootyFruit. --Gotta
> love the names!
>
> What do you think? This is very important to me. Hibernate can do this,
> why can't we?
>
> Thanks!
> Paul
>
>
>
> __________________________________
> Start your day with Yahoo! - Make it your home page!
> http://www.yahoo.com/r/hs
>