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 "Bolinger, Gregg D" <Gr...@intrustbank.com> on 2005/01/06 20:49:24 UTC

Mapping Complex Properties (Load all properties)

I have a JavaBean with several properties.  Some of these properties are
other JavaBeans.  Currently with the code I have I can load these
complex properties, however, it is only loading 1 property.  Here is my
file(s)

<resultMap id="get-issue-result"
class="com.intrust.anykey.web.modelbeans.Issue">
        <result property="issueId" column="issue_id"/>
        <result property="dateCreated" column="date_created"
javaType="java.util.Date"/>
        <result property="dateAccepted" column="date_accepted"
javaType="java.util.Date"/>
        <result property="dateResolved" column="date_resolved"
javaType="java.util.Date"/>
        <result property="dateModified" column="date_modified"
javaType="java.util.Date"/>
        <result property="createdByUser.userId"
column="creating_user_id" />
        <result property="issueNumber" column="issue_number"/>
    </resultMap>

    <statement id="getIssue" parameterClass="int"
resultMap="get-issue-result">
        SELECT * FROM t_issue, t_user WHERE creating_user_id = user_id
AND issue_id = #value#
    </statement>

Now, when I run this and in my java code I want to get the information
about the createdByUser which is of a type User.java.  The only property
in User.java that is being populated in userId.  I need also all the
other properties to be populated.  Now, I understand why only 1 property
is being filled in User.java.  But I don't know how to achieve the
desired functionality I need.

Thanks

Gregg

Re: Mapping Complex Properties (Load all properties)

Posted by Larry Meadors <la...@gmail.com>.
Am I reading this wrong? It looks to me like that is the only result
you have mapped to that bean. The others are all to the Issue bean.

Add other properties, and they will get mapped.

Larry


On Thu, 6 Jan 2005 13:49:24 -0600, Bolinger, Gregg D
<Gr...@intrustbank.com> wrote:
> I have a JavaBean with several properties.  Some of these properties are
> other JavaBeans.  Currently with the code I have I can load these
> complex properties, however, it is only loading 1 property.  Here is my
> file(s)
> 
> <resultMap id="get-issue-result"
> class="com.intrust.anykey.web.modelbeans.Issue">
>         <result property="issueId" column="issue_id"/>
>         <result property="dateCreated" column="date_created"
>           javaType="java.util.Date"/>
>         <result property="dateAccepted" column="date_accepted"
>           javaType="java.util.Date"/>
>         <result property="dateResolved" column="date_resolved"
>           javaType="java.util.Date"/>
>         <result property="dateModified" column="date_modified"
>           javaType="java.util.Date"/>
>         <result property="createdByUser.userId"
>           column="creating_user_id" />
>         <result property="issueNumber" column="issue_number"/>
>     </resultMap>