在做一个项目,插入用户的时候,取用户的id值插入艺术家,艺术家表字段有些值不能为空,
然后用户插入成功,但是插入下一条数据的时候,报.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/linkcare/chengart/model/Artist_SqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the artist.insertArtist-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'birth_year' cannot be null,就是数据库的表不能某些字段不能为空,配置文件如下<bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation">
<value>classpath:SqlMap-Config.xml</value>
</property>
<property name="dataSource" ref="dbcpDataSource" />
</bean>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient" ref="sqlMap" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dbcpDataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
无论是编程式跟注解都不成功,我的想法是不是跟表的设计不能为空有影响,抱歉,分数不多望解答
![](http://img.bbs.csdn.net/upload/201509/14/1442202799_679925.png)
--- The error occurred in com/linkcare/chengart/model/Artist_SqlMap.xml.
--- The error occurred while applying a parameter map.
--- Check the artist.insertArtist-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'birth_year' cannot be null,就是数据库的表不能某些字段不能为空,配置文件如下<bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation">
<value>classpath:SqlMap-Config.xml</value>
</property>
<property name="dataSource" ref="dbcpDataSource" />
</bean>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient" ref="sqlMap" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dbcpDataSource"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
无论是编程式跟注解都不成功,我的想法是不是跟表的设计不能为空有影响,抱歉,分数不多望解答