ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter_J_...@bluecrossmn.com
Subject Extra objects in a list (not multiple independent lists)
Date Fri, 05 Oct 2007 16:54:33 GMT
I am having a problem which is inconsistent.  I guess I am hoping for any 
suggestions about where I can dig into the Ibatis code to see if anything 
is going wrong or if anything is not supported with what I am trying.  My 
assumption is that it lays somewhere in checking for a unique key in the 
BasicResultMap class.

I am running a process that outputs roughly 2000 records to a file.  I am 
running a parallel test with the old (non-Ibatis) code.  In three runs 
this morning, the first and third were identical, and the second had 3 
records that were off.  The db is not being touched by anything else.

I am dealing with an object hierarchy: 

a group has members, a member has accounts, and an account has a plan.
(Earlier, I had an issue that dealt with multiple independent lists, and 
was informed that it is not supported.  This hierarchy is four deep, but 
it does not have branching.)

It seems that sometimes, I end up with some extra  accounts in with a 
member (that exist for other members), but it is not consistent.  One 
assumption that I have made is that groupBy is carried along with use of 
"extends" for resultmaps.

Is there any limitation on the number of groupBys in a hierarchy?  It 
doesn't appear so from looking at BasicResultMap

Here are some snippets from my sqlmaps:



//from group.xml

<resultMap id="group" class="com.xyz.domain.member.Group" groupBy=
"groupId">
        <result property="groupId"                      column="gr_key"/>
        <result property="groupNbr"                     column="gr_grpnum"
/>
</resultMap>

<resultMap id="groupWithMembersWithAccountsWithPlan" class=
"com.xyz.domain.member.Group" 
        extends="group">
                <result property="members"   resultMap=
"Member.memberWithAccountsAndPlans"/>
</resultMap>

<!-- Selects from Group Table -->
<select id="getGroupWithMembersWithAccountsWithPlan" parameterMap=
"groupNumber" 
        resultMap="groupWithMembersWithAccountsWithPlan">
        select
        <include refid="SqlFragment.groupFieldFragment"/>,
        <include refid="SqlFragment.memberFieldFragment"/>,
        <include refid="SqlFragment.accountFieldFragment"/>,
        <include refid="SqlFragment.planFieldFragment"/>
        from group, member, msa, csa
        where gr_key == mb_gr_key
        and mb_key == ms_mb_key
        and ms_cs_key  == cs_key
        and mb_gr_key  == cs_gr_key 
        and gr_grpnum  == ?
</select>



//from member.xml

<!-- Result Maps -->
<resultMap id="member" class="com.xyz.domain.member.Member" groupBy="id">
        <result property="id"                                           
column="mb_key"/>
        <result property="lastName"                             column=
"mb_lname"/>
        <result property="firstName"                            column=
"mb_fname"/> 
</resultMap>

<resultMap id="memberWithAccountsAndPlans" class=
"com.xyz.domain.member.Member" 
        extends="member">
                <result property="accounts"   resultMap=
"Account.accountWithPlans"/>
</resultMap>



//from account.xml
<!-- Result Maps -->
<resultMap id="account" class="com.xyz.domain.member.Account"  groupBy=
"accountId">
        <result property="accountId"                  column="ms_key"/>
        <result property="accountType"                column="ms_acctype"
/>
</resultMap>

<resultMap id="accountWithPlans" class="com.xyz.domain.member.Account" 
         extends="account">
        <result property="plan"            resultMap="Plan.plan"/>
</resultMap>



//from plan.xml
<!-- Result Maps -->
<resultMap id="plan" class="com.xyz.domain.member.Plan" groupBy="planKey">
        <result property="planKey"                 column="cs_key"/>
        <result property="startDate"               column="cs_start"/>
</resultMap>


Thanks a ton for any advice.

Peter Lee


---------------------------- 
Important news about email communications:

If our business rules identify sensitive information, you will receive a ZixMail Secure Message
with a link to view your message. First-time recipients will be asked to create a password
before they are granted access. To learn more about ZixMail, ZixCorp Secure Email Message
Center, and other ZixCorp offerings, please go to http://userawareness.zixcorp.com/secure4/index.php

---------------------------- 

The information contained in this communication may be confidential, and is intended only
for the use of the recipient(s) named above. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution, or copying of this
communication, or any of its contents, is strictly prohibited. If you have received this communication
in error, please return it to the sender immediately and delete the original message and any
copy of it from your computer system. If you have 
any questions concerning this message, please contact the sender. 

Unencrypted, unauthenticated Internet e-mail is inherently insecure. Internet messages may
be corrupted or incomplete, or may incorrectly identify the sender.
Mime
View raw message