Sunday, May 27, 2012

MyBatis Insert

The Mapper interface method accepts the Object :

void insertAccount(Account account);

The Mapper xml uses the properties :

<insert id="insertAccount" parameterType="x.y.z.Account">

               INSERT INTO ACCOUNT (EMAIL, FIRSTNAME, LASTNAME, STATUS, ADDR1, ADDR2, CITY,
               STATE, ZIP, COUNTRY, PHONE, USERID)

VALUES

              (#{email}, #{firstName}, #{lastName}, #{status}, #{address1},  #{address2,jdbcType=VARCHAR}, 
              #{city}, #{state}, #{zip}, #{country}, #{phone}, #{username})

</insert>

No comments:

Post a Comment