1. The query result is returned as follows: {” ID “:2,”userName”: NULL,”userAccount”: NULL,”password”:”33333″,”createTime”:null} There are two possible causes:

1) Database building table, field using camel name

CREATE TABLE sys_common_user(IDint (11) NOT NULL AUTO_INCREMENT COMMENT ‘主键’, User_namevarchar (30) DEFAULT NULL COMMENT ‘user name ‘, user_accountvarchar(15) NOT NULL COMMENT’ user name ‘, Passwordvarchar (15) NOT NULL COMMENT ‘create time ‘, create_time datetime DEFAULT NULL COMMENT’ create time ‘, PRIMARY KEY (id)) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET= UTf8 2)mybatis

Solution: in a configuration file named on the hump, mybatis. Configuration. The map – the underscore – to – camel case = true

2. Insert data in annotation mode, and the following error occurs:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user_name' in 'class com.wl.mapadmin.model.SysCommonUser' at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441) at com.sun.proxy.$Proxy65.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)

The above is caused by the following insert statement:

@Insert("insert into sys_common_user (id,user_name,user_account,password,create_time) values (#{id},#{user_name},#{user_account},#{password},#{create_time})") int add(SysCommonUser user);

The name of the entity field is the same as that of the entity field.

@Insert("insert into sys_common_user (id,user_name,user_account,password,create_time) values (#{id},#{userName},#{userAccount},#{password},#{createTime})") int add(SysCommonUser user);

3. Chinese garbled characters are inserted into the data for the following two possible reasons:

Mysql > alter table set character set utF8

2) mysql configuration link address: JDBC: mysql: / / 127.0.0.1:3306 / gismap? UseUnicode =true&characterEncoding=utf8 useUnicode=true&characterEncoding= UTf8 is required