Home > Database > Mysql Tutorial > Mybatis 插入数据,返回自增长的id

Mybatis 插入数据,返回自增长的id

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 14:58:09
Original
1445 people have browsed it

Mybatis插入数据,返回自增长的id 无 insert id="insert" parameterType="Spares" useGeneratedKeys="true" keyProperty="id"insert into spares(spares_id,spares_name,spares_type_id,spares_spec)values(#{id},#{name},#{typeId},#{spec})/insert sparesDa

Mybatis 插入数据,返回自增长的id
<insert id="insert" parameterType="Spares" 
		useGeneratedKeys="true" keyProperty="id">
	insert into spares(spares_id,spares_name,spares_type_id,spares_spec)
	values(#{id},#{name},#{typeId},#{spec})
</insert>
Copy after login
sparesDao.insert(spares); //插入
spares.getId();//取得主键id
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Mybatis mapping problem
From 1970-01-01 08:00:00
0
0
0
java - Mybatis related query
From 1970-01-01 08:00:00
0
0
0
REGEXP in mybatis
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template