ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomáš Procházka <t.procha...@centrum.cz>
Subject what contain int return value for insert?
Date Sat, 14 Nov 2009 18:48:36 GMT

What contain return int value for this mapper method:

int insert(Group record);

with this mapping delcaration:

  <insert id="insert" parameterType="test.model.Group" >
    insert into `group` (id, name, type,
      locked, lockedby_user)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=CHAR}, 
      #{locked,jdbcType=BIT}, #{lockedbyUser,jdbcType=INTEGER})


A prefer automatically return last insert id, it's possible?

I tried this:

		<selectKey keyProperty="id" resultType="integer">

It update field in Group instance which was used to call insert method, But has no result
to insert method return value.

		<selectKey keyProperty="id" resultType="integer"> SELECT LAST_INSERT_ID();</selectKey>

This should be automatically generated by Ibator. It's very important for easy way to build
related DB data.

To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org

View raw message