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 Mathew Samuel <gr...@yahoo.com> on 2005/09/02 05:38:36 UTC
More than one parameter class/map for the
Is it possible to pass a 2nd custom/standard class
through a queryForObject() or queryForList() ? Or do I
have to combine both objects under a Collection before
sending it in ? I would want to use certain properties
from the 2nd class to aid the 1st in a join, like
shown below:
<resultMap id="tableAResult" class="objectA">
...
</resultMap>
<select id="anId" resultMap="tableAResult"
parameterClass="objectA">
select TableA.field1, TableA.field2
from TableA, TableB
where TableA.field3 = TableB.field1
and TableA.field4 = #propertyOfObjectA#
and TableB.field2 = #someStringNotPartofObjectA#
</select>
How is this acheived ?
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
Re: More than one parameter class/map for the
Posted by Larry Meadors <la...@gmail.com>.
By creating a composite class, or using a Map.
public class Foo{
private YourClassA yourClassA;
private YourClassB yourClassB;
// getters and setters below...
}
Larry
On 9/1/05, Mathew Samuel <gr...@yahoo.com> wrote:
>
> Is it possible to pass a 2nd custom/standard class
> through a queryForObject() or queryForList() ? Or do I
> have to combine both objects under a Collection before
> sending it in ? I would want to use certain properties
> from the 2nd class to aid the 1st in a join, like
> shown below:
>
>
> <resultMap id="tableAResult" class="objectA">
> ...
> </resultMap>
>
> <select id="anId" resultMap="tableAResult"
> parameterClass="objectA">
> select TableA.field1, TableA.field2
> from TableA, TableB
> where TableA.field3 = TableB.field1
> and TableA.field4 = #propertyOfObjectA#
> and TableB.field2 = #someStringNotPartofObjectA#
> </select>
>
> How is this acheived ?
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
>