ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Landry Soules <landry.p.sou...@gmail.com>
Subject Complex properties on insert
Date Wed, 01 Nov 2006 22:19:40 GMT
Hello,

I'm a newbie and couldn't find a single example of how to manage complex 
properties on insert ?

Heres is what i try to do :

I have 2 classes : Address and Country.
In the relation, of course one address has one country.

Country is a stand-alone class, while Address has a property  of type 
Country, something like this :

public class Address ....
private Country country ......

In the mapping :

 <resultMap class="com.myhome.Address" id="abatorgenerated_AddressResult">
 
 <result column="id" jdbcType="INTEGER" property="id"/>
    <result column="add1" jdbcType="VARCHAR" property="add1"/>
    <result column="add2" jdbcType="VARCHAR" property="add2"/>
    <result column="city" jdbcType="VARCHAR" property="city"/>
    <result column="zip_code" jdbcType="VARCHAR" property="zipCode"/>
    <result column="state" jdbcType="INTEGER" property="state"/>
    <result column="country" property="country" 
select="address.getCountry"/>
   </resultMap>
  
     <resultMap id="country-result" class="com.seenxl.model.Country">
  <result column="id" jdbcType="CHAR" property="id"/>
    <result column="iso3" jdbcType="CHAR" property="iso3"/>
    <result column="name" jdbcType="CHAR" property="name"/>
    <result column="num_code" jdbcType="SMALLINT" property="numCode"/>
    <result column="printable_name" jdbcType="CHAR" 
property="printableName"/>
</resultMap>




I have no problem to select an address, but i can't make an insert work.
I there a trick i have skipped  or can you point me to a sample code, 
thank you.


Mime
View raw message