After completion of the return to a primary key value

Add keyProperty attributes and attribute userGeneratedKeys insert the tag in the mapping files

       <! - and returns the user to add primary key ->

       <!--

              keyProperty: The primary key for the entity based on attributes in

              userGeneratedKeys: indicates whether to generate the primary key

        -->

       <insert id="insert" keyProperty="uid" useGeneratedKeys="true">

              insert into users (name,age) value(#{uname},#{uage});

       </insert>

Guess you like

Origin www.cnblogs.com/kfsrex/p/11439615.html