mybatis用序列当作id并随数据一起插入到表中的方法为:
就是在普通的insert语句前加一个<selecKey>标签
<insert id="insert" parameterType="com.nantian.intranetmanage.entity.CustomerInfo">
<selectKey resultType="int" keyProperty="customerId" order="BEFORE">
select CUSTOMER_ID.nextVal from dual
</selectKey>
insert into CUSTOMER_INFO_T ......
)
</insert>