1、Using non-qualified column reference
在hibernate中使用HQL直接对数据库进行update、save、delete操作时,日志中会输出:
- org.hibernate.hql.ast.tree.FromElementType -164767 [http-8080-Processor72] WARN - Using non-qualified column reference
org.hibernate.hql.ast.tree.FromElementType -164767 [http-8080-Processor72] WARN - Using non-qualified column reference
的警告信息。该警告实乃Hibernate-3.2.0版本的BUG,原因是hibernate执行HQL时没有细分操作类型,日志记录类型有误,该BUG已在3.2.1中修复。
2、deleted object would be re-saved by cascade (remove deleted object from associations)
在hibernate 删除关联时会出现eleted object would be re-saved by cascade (remove deleted object from associations)的异常,结合别人的和自己的经验通常有三种解决的方案:
方法1 删除Set方的cascade:
方法2 解决关联关系后,再删除
onside.getManys().remove(thisMany); //在所关联的一方的set中移走当前要删除的对象
thisMany.setOne(null); //设置所对应的一方为空,解除它们之间的关系
manyDao.delete(thisMany);
方法3 在many-to-one方增加cascade 但值不能是none