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
|