-3

親エンティティは、親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-エージェンシーのレコードの削除83285913: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]-エラー2012-07-0113: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]-エラー2012-07-0113:29:56,251 [] JDBCExceptionReporter-ORA-02292:整合性制約(KCBUSER.FK6B6B82ABC89B1A0C)に違反しました-子レコードが見つかりました13:29:56,253 INFO [STDOUT][Mobee]-エラー2012-07-0113: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)at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92)at org.hibernate.j .AbstractBatcher.prepareStatement(AbstractBatcher.java:87)at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:222)at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2479) 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)at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)atorg。 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)at com.manam.mobee.agency.MobeeAgencyHome.update(MobeeAgencyHome.java:2599)at com.manam.mobee.agency.MobeeAgencyHome.processUserDecision(MobeeAgencyHome。 java:2465)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke (不明なソース)org.jboss.seam.util.Reflections.invoke(Reflections.java:22)at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)at org.jboss.seam.intercept .SeamInvocationContext.proceed(SeamInvocationContext.java:56)at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)atorg。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.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)でorg.jboss.seam.coreで。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)at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)at com.manam.mobee.agency.MobeeAgencyHome _ $$ _ javassist_seam_15.processUserDecision(MobeeAgencyHome _ $$ _ javassist_seam_15 sun.reflectでreflect.NativeMethodAccessorImpl.invoke0(ネイティブメソッド)。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.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:280)at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)at org.jboss.el.parser.AstMethodSuffix .invoke(AstMethodSuffix.java:65)at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)atcom.sun。 facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)atcom.sun.faces。application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)at javax.faces.component.UICommand.broadcast(UICommand.java:383)at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)at org.ajax4jsf .component.AjaxViewRoot.processEvents(AjaxViewRoot.java:324)at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:299)at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:256)atorg。 ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:469)at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java: 251)com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)atjavax.faces.webapp.FacesServlet。service(FacesServlet.java:244)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.ajax4jsf .webapp.BaseFilter.doFilter(BaseFilter.java:530)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206 )org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)atorg.apache.catalina.core.ApplicationDispatcher。 org.apache.catalina.coreのdoForward(ApplicationDispatcher.java:379)。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)at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)at org.jboss.seam.servlet.SeamFilter $ FilterChainImpl.doFilter(SeamFilter.java:69)at org.jboss.seam.servlet.SeamFilter $ FilterChainImpl.doFilter(SeamFilter.java:69)のorg.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)(org.jboss.seam.web.RedirectFilter)。 doFilter(RedirectFilter.java:45)org.jboss.seam.servlet.SeamFilter $ FilterChainImpl.doFilter(SeamFilter.java:69)at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)at org.ajax4jsf.webapp.BaseFilter.handleRequest (BaseFilter.java:290)org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)atorg.jboss.seam.web。 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) at org.jboss.seam.servlet.SeamFilter $ FilterChainImpl.doFilter(SeamFilter.java:69)at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:13:29:56,253 INFO [STDOUT] 158)at 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)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:230)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)atorg。 apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)at org.apache.catalina.valves .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.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)atorg.apache.coyote.http11。 Http11Protocol $ Http11ConnectionHandler.process(Http11Protocol.java:583)at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run(JIoEndpoint.java:446)atjava.lang.Thread。run(不明なソース)原因:java.sql.BatchUpdateException:ORA-02292:整合性制約(KCBUSER.FK6B6B82ABC89B1A0C)に違反しています-子レコードが見つかりました

4

2 に答える 2

1

ただチェックしてください:

select distinct lvl cleanup_order, t1 clean_table, t2 to_clean_table 
from 
(SELECT level lvl, t2, t1, i2, c1, c2
FROM
  (
    SELECT c1.owner, c1.table_name t1, c2.table_name t2, c2.index_name i2,
      c1.constraint_name c1, c2.constraint_name c2
    FROM user_constraints c1, user_constraints c2
    WHERE c1.constraint_type = 'R'
    AND c1.r_constraint_name = c2.constraint_name
    AND c1.r_owner           = c2.owner
  )
  ov
  START WITH t2       in ('YOUR_TABLE_YOU_WANT_DELETE')  ---List tables which have to be cleaned.
  CONNECT BY prior T1 = T2) lvl
 -- where t1 is not NULL
  order by lvl desc, to_clean_table;
于 2012-09-14T13:45:00.420 に答える
1

エンティティを削除するときに子を削除する場合

@カスケード(DELETE_ORPHAN)

JPA 2ならできる

@OneToMany(orphanRemoval=true)

于 2012-07-01T09:49:42.737 に答える