ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: using result maps within result maps
Date Thu, 20 Oct 2005 14:24:49 GMT
If it's 1:1 or M:1 (vs. M:N or 1:M), then why not just join the tables and
use dot.notation.to.specify.the.properties you want to map to?

The resultMap attribute is part of the M:N N+1 selects solution...it's not
just for arbitrary mapping using a different result map....there's no need,
as you can do it all in one map.

Cheers,
Clinton


On 10/19/05, neilhenry@f2s.com <neilhenry@f2s.com> wrote:
>
> I have a situation where I have several tables with one-to-one
> relationships.
> Each of which has 20 + columns.
>
> As each of them requires to be queried individually I have created result
> maps
> for each one.
>
> We also need to get all the data related to the central table and I would
> like
> to do this in one select statement.
>
> I have done this following the N+1 select user guide so have the correct
> sql. I
> tried to map the result with the following xml node:
>
> <result property="child" resultMap="Child.allValues" javaType="data.Child
> "/>
>
> Unfortunatly this gives me a class cast exception - when calling the
> following:
>
>
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setNestedResultMappingValue
> (BasicResultMap.java:384)
>
> It is giving me a list!
>
> Is there currently a way to correctly specify the class, so that I don't
> have to
> have lists of sub-classes when I know it is a one to one mapping?
>
> I know I can specify each property as child.propertyName, but as I already
> have
> this specified it seems wastful - also I end up with a result map with
> hundereds of properties - most on sub-classes.
>
> Thanks for any help
> Neil
>
>

Mime
View raw message