ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Complex Object resultMap
Date Wed, 18 Oct 2006 17:26:49 GMT
Interesting.  I've verified this behavior that if a result map only includes
another nested result map, then this failure occurs.

Begs the question - why would you do this?  Why not simply have the
ProviderRelationship class hold the Person class directly - without the
intermediate Patient class that has no other properties?  Although I suppose
the Patient class could hold other properties that are filled in at another
time.

But this does seem like a bug.  Feel free to file a JIRA ticket for it so we
don't forget - or I'll do it if you prefer.  I have a small test case that
proves it.  Let me know.

Jeff Butler



On 10/18/06, Espenschied, Jim <Jim.Espenschied@ps.net> wrote:
>
>  I am trying to populate a complex object. I have included the resultMaps
> below. iBatis builds out the object correctly except for the Physician
> class. It leaves the supplier attribute as null in ProviderRelationship. I
> added an attribute called hospitalID to Physician. When I uncomment <!--
> <result property="hospitalID" column="PNHSP#"/>  --> ibatis will populate
> Physician.
>
>
>
> Why does it only work if I add this attribute? I would like to remove the
> hospitalID attribute.
>
>
>
> Any help would be greatly appreciated.
>
>
>
> Thanks,
>
>
>
> Jim
>
>
>
>             <resultMap id="patientEncounterResultMap" class="
> hdi.domain.PatientEncounter" groupBy="accountNumber">
>
>                         <result property="accountNumber"
> column="PNACCT"/>
>
>                         <result property="relationships" resultMap="
> HIS.providerRelationshipResultMap"/>
>
>                         <result property="patient" resultMap="
> HIS.patientResultMap"/>
>
>             </resultMap>
>
>
>
>             <resultMap id="personPatientResultMap" class="
> psc.domain.Person" groupBy="lastName, firstName">
>
>                         <result property="lastName"
> column="HAPLNM"/>
>
>                         <result property="firstName" column="HAPFNM"/>
>
>             </resultMap>
>
>
>
>             <resultMap id="patientResultMap" class="hdi.domain.Patient">
>
>
>                         <result property="party" resultMap="
> HIS.personPatientResultMap"/>
>
>                         <result property="medicalRecordNumber"
> column="PNMRC#"/>
>
>
>             </resultMap>
>
>
>
>             <resultMap id="providerRelationshipResultMap" class="
> hdi.domain.ProviderRelationship">
>
>                         <result property="client" resultMap="
> HIS.patientResultMap"/>
>
>                         <result property="supplier" resultMap="
> HIS.physicianResultMap"/>
>
>                         <result property="type"
> column="PNRELD"/>
>
>             </resultMap>
>
>
>
>             <resultMap id="personPhysicianResultMap" class="
> psc.domain.Person">
>
>                         <result property="lastName"
> column="PNDNAM"/>
>
>                         <result property="firstName" column="PNDNAM"/>
>
>             </resultMap>
>
>
>
>             <resultMap id="physicianResultMap" class="hdi.domain.Physician">
>
>
>                         <result property="party" resultMap="
> HIS.personPhysicianResultMap"/>
>
> <!--                   <result property="hospitalID" column="PNHSP#"/>
> -->
>
>             </resultMap>
>

Mime
View raw message