日期:2014-05-17 浏览次数:20664 次
<insert id="insert" parameterType="com.imad.po.UserInfo" useGeneratedKeys="true" keyProperty="uId">
insert into tbl_UserInfo(uUserName,uPassword)
values(#{uUserName},#{uPassword})
</insert>
create table tbl_UserInfo(
uId int primary key auto_increment,
uUserName varchar(255),
uPassword varchar(255)
);
useGeneratedKeys="true" keyProperty="uId"
Exception in thread "AWT-EventQueue-0" org.springframework.jdbc.BadSqlGrammarException: Error getting generated key or setting result to parameter object. Cause: java.sql.SQLException: Column 'null' not found.
; bad SQL grammar []; nested exception is java.sql.SQLException: Column 'null' not found.
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:346)
at $Proxy3.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:231)
at com.imad.dao.UserInfoDAO.insert(UserInfoDAO.java:71)
at com.imad.service.UserInfoService.insert(UserInfoService.java:56)
at com.imad.ui.ExRegister.doActionOnBtnNextClicked(ExRegister.java:159)
at com.imad.ui.ExRegister.access$2(ExRegister.java:146)
at com.imad.ui.ExRegister$3.mouseClicked(ExRegister.java:110)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)