ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Elfert <thorsten.elf...@db.com>
Subject Empty ArrayList instead of null in ResultSet
Date Thu, 15 Nov 2007 13:43:52 GMT
Hi,

I try to implement the mapping of a 1:m relationship. Whereas the 
associated collection could also be empty . For the following example I 
used the Entities TestCaseParameters and TestCaseSubstitutions.In which 
TestCaseSubstitutions is associated as ArrayList to TestCaseParameter.

I am wondering about the following result. Even if no data was found for 
TestCaseSubstitutions an empty ArrayList gets instantiated.

You can see this behaviour in the following dump of the resulting objects:
TestCaseParameter ( ...  substitutes = []     ), ......, substitutes = []  
  )]     )

(I deleted all the irrelevant stuff)

So, every time - even when no data for the associated table could be 
loaded the ArrayList gets somehow instantiated with empty content.
My expectation was, that the attribute substitutes would just be "null". 

For better understanding find below an extract of the corresponding result 
map:

        <resultMap id="testcaseparameter-result" class=
"test.com.db.rocs.dao.helper.TestCaseParameter"  >
                <result property="id" column="TEST_CASE_PARAMETER_ID" />
                                ...
                <result property="substitutes" column=
"TEST_CASE_PARAMETER_ID" select="getTestCaseSubstitutes" />
        </resultMap>

        <resultMap id="testcasesubstitutes-result" class=
"test.com.db.rocs.dao.helper.TestCaseDataSubstitution">
                        ...
                <result property="dtoSetter" column="DTO_SETTER" />
        </resultMap>

Is it somehow possible to tell iBatis  what to do in this case? Or did I 
misinterpret this behaviour?

Thanks for your help!





-- 

Informationen (einschließlich Pflichtangaben) zu einzelnen, innerhalb der EU tätigen Gesellschaften
und Zweigniederlassungen des Konzerns Deutsche Bank finden Sie unter http://www.db.com/de/content/pflichtangaben.htm.
Diese E-Mail enthält vertrauliche und/ oder rechtlich geschützte Informationen. Wenn Sie
nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren
Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for information (including
mandatory corporate particulars) on selected Deutsche Bank branches and group companies registered
or incorporated in the European Union. This e-mail may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure
or distribution of the material in this e-mail is strictly forbidden.
Mime
View raw message