ssm框架实战遇到的一些bug以及解决方法--上篇(还没写完)

java.lang.IllegalArgumentException: addChild: Child name hjxy9 is not unique解决方法

原因是:
ssm框架实战遇到的一些bug以及解决方法--上篇(还没写完)_第1张图片
问题是这里出现了 多个,但是我的只有一个也报错了,嗯删除,重新增加之后,就没有这个了错了。

ssm框架给在实体类中给数据库字段起新的别名时,需要对应sql语句里面的新别名,否则查询为空

当我们插入数据时主键是自增的,当插完我们需要立马用的时候就可以在xml文件上加上,加上之后插入完数据就可以x.getID()拿到ID值。

The error occurred while setting parameters

SQL: insert into college (college_id,college_name) values (?,?);

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column ‘college_name’ cannot be null

; SQL []; Column ‘college_name’ cannot be null; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column ‘college_name’ cannot be null] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column ‘college_name’ cannot be null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

你可能感兴趣的:(java,mybatis,java)