hibernate中many-to-one关联时出现ObjectNotFoundException异常
2020-02-02 14:26
961 查看
采用多对一关联,如果一的那端删除了,多的这端无法感知,虽然数据库中可以通过外键配置将多的一端置空,可是在hibernate里面我暂时不知道如何处理。
目前采用的方式:
1、首先,数据库中需要配置好外键,保证数据库中的数据是正确的。
2、在hibernate的many-to-one元素中增加一个属性:not-found="ignore".
若有更合适的方法,还望告知。
转载于:https://www.cnblogs.com/tq03/p/4108197.html
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- org.hibernate.PropertyNotFoundException: Could not find a getter for employee in class com.itcast.f_hbm_oneToMany.Department
- hibernate中many-to-one关联时出现ObjectNotFoundException异常
- hibernate many-to-one关联,多的一端关联一的一端的外键对应数据被删了,如何避免抛出ObjectNotFoundException
- hibernate注解版关联映射Many-to-One/Many-to-Many等&异常处理
- Hibernate和spring整合出现NotFoundException: org.objectweb.asm.codevisitor错误的解决方法
- org.hibernate.ObjectNotFoundException异常的分析及其解决办法
- spring hiberante 集成出现异常 java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor
- org.hibernate.AnnotationException: Referenced property not a (One|Many)ToOne: in mappedBy of
- 性能测试出现FileNotFoundException: Too many open files的异常原因
- hibernate OneToMany,ManyToMany 插入时候出现重复键值异常
- 关于hibernate项目打war包放在tomcat运行出现异常问题java.lang.ClassNotFoundException: javax.xml.bind.JAXBException...
- myeclipse 使用weblogic10启动hibernate项目时出现ClassNotFoundException: org.hibernate.hql.ast.HqlToken异常的解决办法
- Error/Exception-01-hibernate(jar包冲突)--javax.persistence.OneToMany.orphanRemoval()Z异常
- org.hibernate.ObjectNotFoundException异常一则
- Hibernate 中annotations(注解开发)的@OneToMany 一对多双向关联映射后,出现的jar包冲突问题
- jsp项目文件运行出现java.lang.ClassNotFoundException和Failed to load or instantiate TagExtraInfo class异常
- hibernate异常分析:org.hibernate.ObjectNotFoundException
- org.hibernate.ObjectNotFoundException
- rg.hibernate.ObjectNotFoundException: No row with the given identifier exists
- Rational Rose 2003破解版的下载与安装以及出现java.lang.ClassNotFoundException异常的解决方法