ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neilhe...@f2s.com
Subject Re: using result maps within result maps
Date Fri, 28 Oct 2005 15:58:25 GMT
That is true, but as I am getting a very wide result set from lots of tables and
also getting that same data from each table at other times it requires
duplication of property mappings.

I have moved the select clauses into sql fragments so that I don't have to have
them written out multiple times, but I need to write them out multiple times in
the result maps!

It would be nice if I could use the resultMap attribute specifying that there
was only a single one of them, thus reducing the replication required.

I guess this is a change request really though!

Regards
Neil

Quoting Clinton Begin <clinton.begin@gmail.com>:

> 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