CREATE TABLE userInfo
userId INTEGER PRIMARY KEY,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
);
<insert id="insertUser" parameterType="userVo">
<![CDATA[
INSERT INTO userInfo (
first_name
,last_name
) VALUES (
#{firstName}
,#{lastName}
)
]]>
<selectKey keyProperty="userId" resultType="int">
SELECT LAST_INSERT_ROWID()
</selectKey>
</insert>
public class UserInfoDAOImpl extends BaseDAO implements UserInfoDAO{
@Override
public int insertJob(UserVo userVo) throws OSPException {
int returnVal = -1;
returnVal = (Integer) getSqlSession().insert("com.test.dao.UserInfoDAO.insertUser", userVo);
System.out.println("userId="+userVo.getUserId());
return returnVal;
}
}
댓글 없음:
댓글 쓰기