解决JDBCTemplate queryForList查询出来的某些数字自动转换为true和false的问题
问题原因
MySQL数据库的字段数据类型为TINYINT
解决方法
转换为SMALLINT
解决IntelliJ IDEA Java未使用public方法警告的问题
问题原因
默认情况下,public没使用过的方法会有警告
解决方法
解决设置如下:
Of course you can turn it off.Settings | Inspections | Declaration redundancy | Unused declararation.
Turning off this specific inspection will turn off editor highlighting forunused public members.
Unused private members will still be highlighted.
关闭后依然会检查private方法
可以通过scope来控制哪部分代码该检查
解决Hibernate数据无法save,且后台无报错的问题
问题原因
这是由于没有事务造成的
解决方法
方法加上注解
@Transactional(readOnly = false, rollbackFor = Exception.class)
或者可以利用hibernate的session开始事务
解决Hibernate找不到session的问题
问题描述
2016-06-06 15:43:24 2016-06-06 15:43:24,525 - ERROR LogInit( 55 ) -*org.hibernate.HibernateException*: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
问题原因
没有加入事务
解决方法
将@Transactional加到方法或类,例如可以加到DAO的类,也可以加到调用DAO的方法上(service的方法)
加到service类上不会报错,但数据库操作不会提交,原因不明,可能与代理形式有关
解决Hibernate实体类Repeated column in mapping for entity的问题
问题描述
Repeated column in mapping for entity: XXpojo column: xx (should be mapped with insert="false" update="false")
问题原因
这是由于同一个数据库列映射到多个成员变量上
解决方法
取消重复,或加上在注解配置上insert="false" update="false"
解决Eclipse校验XML时无法获取在线XSD文件报错的问题
解决方法
You could try adding a user specified catalog contribution to Eclipse. Under Window->Preferences->XML->XML Catalog select User Specified Entries and then the Add button.
You can then add the details for the schema (you could copy the file locally in case of dropped connection). Eclipse will then have access to the schema during...
332 post articles, 34 pages.