ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "D. Richter" <dr-iba...@gmx.de>
Subject Re: Complex Property is null
Date Tue, 04 Apr 2006 12:25:35 GMT
Ok, I found the mistake by myself. It is a type mismatch
in the Person-Select. The db-type of id ist varchar, so the
parameterClass must be string. Unfortunately no error or warning
points to the mistake.

Dennis

> --- Urspr√ľngliche Nachricht ---
> Von: "D. Richter" <dr-ibatis@gmx.de>
> An: user-java@ibatis.apache.org
> Betreff: Complex Property is null
> Datum: Tue, 4 Apr 2006 14:04:07 +0200 (MEST)
> 
> Hi,
> 
> I have two classes:
> 
> public class EMail
> {
>   private String id;
>   private String subject;
>   private Person from;
>   ...
> }
> 
> public class Person
> {
>   private String id;
>   private String name;
>   ...
> }
> 
> and a configfile
> 
> ...
> <sqlMap namespace="EMail">
> 
> <resultMap id="getEMailByIdResult" class="EMail">
>  <result property="id" column="id"/>
>  <result property="subject" column="subject"/>
>  <result property="from" column="from" select="getPersonById"/>
> </resultMap>
> 
> <resultMap id="getPersonByIdResult" class="Person">
>  <result property="id" column="id"/>
>  <result property="name" column="name"/>
> </resultMap>
> 
> <select id="getEMailById" resultMap="getEMailByIdResult"
> parameterClass="int">
>  SELECT id, subject, from
>  FROM email
>  WHERE id = #id#
> </select>
> 	
> <select id="getPersonById" resultMap="getPersonByIdResult"
> parameterClass="int">
>  SELECT id, name
>  FROM person
>  WHERE id = #id#
> </select>
> 	
> </sqlMap>
> 
> When I call queryForObject, I get the following logs:
> 
> Created connection 17627854.
> {conn-100000} Connection
> {pstm-100001} PreparedStatement: SELECT id, subject, from FROM email WHERE
> id = ? 
> {pstm-100001} Parameters: [1]
> {pstm-100001} Types: [java.lang.Integer]
> {rset-100002} ResultSet
> {pstm-100003} PreparedStatement: SELECT id, name FROM person WHERE id = ? 
> {pstm-100003} Parameters: [96]
> {pstm-100003} Types: [java.lang.Integer]
> {rset-100004} ResultSet
> {rset-100002} Header: [mata_id, mata_vbetrag, mata_vwbezk, mata_zpkey]
> {rset-100002} Result: [1, A_subject, 96]
> Returned connection 17627854 to pool.
> 
> No error/exception occurs, but the property 'from' in the instance of
> 'EMail' is still null. Can anyone help me to find the mistake?
> 
> Thank you
> Dennis
> 
> -- 
> Analog-/ISDN-Nutzer sparen mit GMX SmartSurfer bis zu 70%!
> Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer
> 

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

Mime
View raw message