摘要: 我刚刚在做部门模块,结果在部门树形结构下想删除某个节点,一带把他的子节点也删除了,但如何设置都发现删除不了,会报出错误:Cannot delete or update a parent row: a foreign key constraint fails (`oa`.`department`, CONSTRAINT `FK_rll3cq4b2ghx2lmgj6c31o70m` FOREIGN KEY (`parentDept_id`) REFERENCES `department` (`id`))could not execute statementcould not execute sta 阅读全文
posted @ 2014-04-10 14:33 Yhiloon 阅读(745) 评论(2) 推荐(0) 编辑
摘要: 让hibernate4与3在配置文件中的区别有几点:1、获取sessionfactory的方式:在hibernate3中获取sessionfactory的方式:在hibernate4中则是使用这种方式:2、事物的使用:hibernate3:hibernate4:3、使用缓存机制:hibernate3:thread hibernate4:org.springframework.orm.hibernate4.SpringSessionContext 4、在hibernate3中可以使用hibernate自带的Dao组件,如:HibernateTemplete/HibernateDaoS... 阅读全文
posted @ 2014-04-10 12:49 Yhiloon 阅读(3276) 评论(1) 推荐(0) 编辑
摘要: 昨天,在做一个项目的时候,发现了报出了这个问题:Use of @OneToMany or @ManyToMany targeting an unmapped class然后自己找了很久发现,原来是配置文件出了问题,没有声明这个类: com.itcast.oa.domain.Role com.itcast.oa.domain.Department com.itcast.oa.domain.User 其次还报出的了这个问题:Associations marked as mappedBy must not define database mappings like @... 阅读全文
posted @ 2014-04-10 12:29 Yhiloon 阅读(2135) 评论(0) 推荐(0) 编辑