Should your resultmap be address-result instead of company.address- result?

Richard

Sent from my iPhone

On Apr 2, 2009, at 6:25 AM, mikkapl <fo...@wp.pl> wrote:




Ingmar Lötzsch wrote:

You don't need a custom TypeHandler. But perhaps you have to provide
more information.


I get exception:
--- Check the company.company-result.
--- The error happened while setting a property on the result object.
--- Cause: com.ibatis.sqlmap.client.SqlMapException: Error instantiating
collection property for mapping 'address'.  Cause:
java.lang.ClassCastException:


I have Company.xml where is all typeAliases, resultMap, sql statement
I use useStatementNamespaces="true", so I must have <sqlMap
namespace="company">

DAO:
return getSqlMapClientTemplate().queryForList("company.getAll");

XML:
<select id="getAll" resultMap="company-result">
SELECT
   c.company_id, c.companyname,
   a.address_id, a.street
FROM hh_companies c
LEFT JOIN hh_addresses a ON c.address_id = a.address_id
</select>
** all companies have its addresses; no null values

<resultMap id="address-result" class="Address">
   <result property="addressId" column="address_id" />
   <result property="street" column="street" />
</resultMap>

<resultMap id="company-result" class="Company">
   <result property="companyId" column="company_id" />
   <result property="name" column="companyname" />
   <result property="address" javaType="Address"
resultMap="company.address-result" />
</resultMap>



--
View this message in context: 
http://www.nabble.com/-resultMap--related-objects-tp22845356p22847806.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Reply via email to