ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oates, Richard Dr." <Richard.Oa...@comdirect.de>
Subject nested complex mappings
Date Mon, 01 Aug 2005 07:06:34 GMT

is there a limitation on the "depth" of a complex mapping?

I've got a situation where the gender attribute of a Person object is
mapped into an attribute table which is in turn mapped to an attribute
type. Each of these is retrieved using the <result ... select="..."/>
construct. The nesting is therefore 3 deep.

Leaving aside the select+1 problems, I can't get this to work. I only see
ibatis performing 2 selects (on the "person" and
the "schluessel" table). The third select (on "schluessel_typ") does
not seem to be performed. The objects involved are also not

13:00:38,744 DEBUG DataSourceUtils:106 - Opening JDBC Connection
13:00:39,447 DEBUG Connection:23 - {conn-100000} Connection
13:00:39,603 DEBUG PreparedStatement:23 - {pstm-100001}
PreparedStatement:              select *          from PERSON
where BP_ID = ?          and ANTRAG_ID = ?
13:00:39,603 DEBUG PreparedStatement:23 - {pstm-100001} Parameters:
[8734, 4821536]
13:00:39,603 DEBUG PreparedStatement:23 - {pstm-100001} Types:
[java.lang.Long, java.lang.Long]
13:00:39,618 DEBUG ResultSet:23 - {rset-100002} ResultSet
13:00:39,681 DEBUG PreparedStatement:23 - {pstm-100003}
PreparedStatement:    select * from SCHLUESSEL   where
13:00:39,681 DEBUG PreparedStatement:23 - {pstm-100003} Parameters: [M]
13:00:39,681 DEBUG PreparedStatement:23 - {pstm-100003} Types:
13:00:39,681 DEBUG ResultSet:23 - {rset-100004} ResultSet
13:00:39,696 DEBUG ResultSet:23 - {rset-100002} Header: [ANTRAG_ID,
13:00:39,696 DEBUG ResultSet:23 - {rset-100002} Result: [4821536, 8734, M]
13:00:39,696 DEBUG DataSourceUtils:271 - Closing JDBC Connection

Is this a known limitation on this sort of mapping?

thanks for any help!

The mappings (modified slightly to remove extraneous columns) are as follows:

The Person.GESCHLECHT column is mapped via the select attribute to
another select statement ("getGeschlechtSchluessel"). A column of this
table ("schluessel") is then mapped again to "getSchluesselTyp" which
retrieves data from a 3rd table ("schluessel_typ"). This 3rd select
does not seem to be performed.

       <resultMap id="getPersonResult" class="person">
               <result property="id" column="BP_ID" javaType="java.lang.Long" />
               <result property="geschlecht" column="GESCHLECHT"
                       javaType="string" select="getGeschlechtSchluessel" />
       <select id="getPerson" parameterClass="map"
               resultMap="getPersonResult" >
        select *
        from PERSON
        where BP_ID = #bpid#

       <resultMap id="getGeschlechtSchluesselResult"
               <result property="typ" column="SCHLUESSEL_TYP"
                       select="getSchluesselTyp" />
               <result property="code" column="SCHLUESSEL_CODE" />
       <select id="getGeschlechtSchluessel" parameterClass="string"
               select * from SCHLUESSEL
               where SCHLUESSEL_TYP='00041'
               and SCHLUESSEL_CODE = #value#

       <resultMap id="getSchluesselTypResult" class="schluesselTyp">
               <result property="typ" column="SCHLUESSEL_TYP" />
               <result property="beschreibung" column="BESCHREIBUNG" />
       <select id="getSchluesselTyp" parameterClass="java.lang.String"
               select * from SCHLUESSEL_TYP
               where SCHLUESSEL_TYP=#value#

comdirect bank Aktiengesellschaft
Pascalkehre 15, 25451 Quickborn
(HRB 4889 Pinneberg)
Internet: www.comdirect.de

Vorstand: Andre Carls (Vorsitzender), Karin Katerbau
Vorsitzender des Aufsichtsrates: Achim Kassow

View raw message