当我删除父 ID 时,父实体是许多关系的组成部分,我给出的例外是 ORA-02292 约束违规 - 找到子记录。
我的实体:
@实体
@Table(name = "MOBEE_AGENCY")
公共类 MobeeAgency 实现 java.io.Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Set<MobeeAgent> mobeeAgents = new HashSet<MobeeAgent>(0);
private Set<MobeeAgcyAccounts> mobeeAgcyAccountses = new HashSet<MobeeAgcyAccounts>(
0);
private Set<MobeeAgencyRegion> MobeeAgencyRegions = new HashSet<MobeeAgencyRegion>(0);
@Id
@GeneratedValue(generator = "MOBEE_AGENCY_SEQ")
@SequenceGenerator(name = "MOBEE_AGENCY_SEQ", sequenceName = "MOBEE_AGENCY_SEQ", allocationSize = 1)
@Column(name = "ID")
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@OneToOne(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY)
@JoinColumn(name = "APP_ID")
public MobeeRegProcess getMobeeRegProcess() {
return this.mobeeRegProcess;
}
public void setMobeeRegProcess(MobeeRegProcess mobeeRegProcess) {
this.mobeeRegProcess = mobeeRegProcess;
}
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY, mappedBy = "mobeeAgency")
public Set<MobeeAgent> getMobeeAgents() {
return this.mobeeAgents;
}
public void setMobeeAgents(Set<MobeeAgent> mobeeAgents) {
this.mobeeAgents = mobeeAgents;
}
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY, mappedBy = "mobeeAgency")
public Set<MobeeAgcyAccounts> getMobeeAgcyAccountses() {
return this.mobeeAgcyAccountses;
}
public void setMobeeAgcyAccountses(
Set<MobeeAgcyAccounts> mobeeAgcyAccountses) {
this.mobeeAgcyAccountses = mobeeAgcyAccountses;
}
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY, mappedBy = "mobeeAgency")
public Set<MobeeAgencyRegion> getMobeeAgencyRegions() {
return MobeeAgencyRegions;
}
public void setMobeeAgencyRegions(Set<MobeeAgencyRegion> mobeeAgencyRegions) {
MobeeAgencyRegions = mobeeAgencyRegions;
}
}
获得例外是:
13:29:56,226 INFO [STDOUT] [Mobee]- INFO 2012-07-01 13:29:56,225 [] MobeeAgencyHome - 删除该机构的记录 832859 13:29:56,251 INFO [STDOUT] [Mobee]- WARN 2012- 07-01 13:29:56,251 [] JDBCExceptionReporter - SQL 错误:2292,SQLState:23000 13:29:56,251 信息 [STDOUT] [Mobee]-错误 2012-07-01 13:29:56,251 [] JDBCExceptionReporter - ORA- 02292:违反完整性约束 (KCBUSER.FK6B6B82ABC89B1A0C) - 找到子记录 13:29:56,251 INFO [STDOUT] [Mobee]- WARN 2012-07-01 13:29:56,251 [] JDBCExceptionReporter - SQL 错误:2292,SQLState:23000 13:29:56,251 INFO [STDOUT] [Mobee]-ERROR 2012-07-01 13:29:56,251 [] JDBCExceptionReporter - ORA-02292:违反完整性约束 (KCBUSER.FK6B6B82ABC89B1A0C) - 发现子记录 13:29:56,253 INFO [标准输出] [Mobee]-错误 2012-07-01 13:29:56,251 [] AbstractFlushingEventListener - 无法将数据库状态与会话 org.hibernate.exception.ConstraintViolationException 同步:无法在 org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) 在 org.hibernate.exception 处执行 JDBC 批量更新。 JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) 在 org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253) 在 org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92) 在 org.hibernate.jdbc .AbstractBatcher.prepareStatement(AbstractBatcher.java:87) 在 org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:222) 在 org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2479) 在 org. hibernate.persister.entity。AbstractEntityPersister.delete(AbstractEntityPersister.java:2697) at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.engine .ActionQueue.executeActions(ActionQueue.java:234) 在 org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146) 在 org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) 在 org. hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:296)在 org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:92) 在 org.jboss.seam.framework.EntityHome.update(EntityHome.java:64) 在 com.manam.mobee.agency.MobeeAgencyHome.update(MobeeAgencyHome.java:2599) 在 com.manam.mobee.agency.MobeeAgencyHome.processUserDecision(MobeeAgencyHome. java:2465) 在 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 在 java.lang.reflect.Method.invoke (来源不明) org.jboss.seam.util.Reflections.invoke(Reflections.java:22) org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) org.jboss.seam.intercept .SeamInvocationContext.proceed(SeamInvocationContext.java:56) 在 org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) 在 org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext. java:68) at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:56) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.transaction .TransactionInterceptor$1.work(TransactionInterceptor.java:97) at org.jboss.seam.util.Work.workInTransaction(Work.java:47) at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)在 org.jboss.seam.core 的 org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)。MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:163) at org .jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor .java:185) 在 org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) 在 com.manam.mobee.agency.MobeeAgencyHome_$$_javassist_seam_15.processUserDecision(MobeeAgencyHome_$$_javassist_seam_15.java) 在太阳。 reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect。NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java: 335) 在 org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59) 在 org.jboss.el.parser.AstMethodSuffix 的 org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:280) .invoke(AstMethodSuffix.java:65) 在 org.jboss.el.parser.AstValue.invoke(AstValue.java:96) 在 org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) 在 com.sun。 facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) 在 javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77) 在 com.sun.faces。application.ActionListenerImpl.processAction(ActionListenerImpl.java:91) 在 javax.faces.component.UICommand.broadcast(UICommand.java:383) 在 org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55) 在 org.ajax4jsf .component.AjaxViewRoot.processEvents(AjaxViewRoot.java:324) 在 org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:299) 在 org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:256) 在 org. ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:469) 在 com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97) 在 com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java: 251) 在 com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) 在 javax.faces.webapp.FacesServlet。org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 的服务(FacesServlet.java:244) org.ajax4jsf 的 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) .webapp.BaseFilter.doFilter(BaseFilter.java:530) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206 ) 在 org.apache.catalina.core.ApplicationDispatcher 的 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445) 的 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)。 doForward(ApplicationDispatcher.java:379) 在 org.apache.catalina.core。ApplicationDispatcher.forward(ApplicationDispatcher.java:292) at org.jboss.seam.web.RewriteFilter.process(RewriteFilter.java:98) at org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:57) at org .jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl .doFilter(SeamFilter.java:69) 在 org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) 在 org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 在org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) 在 org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 在 org.jboss.seam.web.RedirectFilter。 doFilter(RedirectFilter.java:45) 在 org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) 在 org.ajax4jsf.webapp.BaseFilter.handleRequest 的 org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) (BaseFilter.java:290) 在 org.jboss.seam.web 的 org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) 的 org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)。 Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)在 org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) 在 org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java: 13:29:56,253 INFO [STDOUT] 158) 在org.apache.catalina.core。ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 在 org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:230) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 在 org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) 在 org. apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:第432章.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :109) 在 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) 在 org.apache.coyote.http11 的 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)。 Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) 在 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) 在 java.lang.Thread。运行(未知来源)原因:java.sql.BatchUpdateException:ORA-02292:违反完整性约束(KCBUSER.FK6B6B82ABC89B1A0C) - 找到子记录