Cascade delete in hibernate 3

i am having a problem deleting child object
here is my code
my hibernate files are generated with xdoclet
I want to remove an object AFVALSTOF with all it's childs. the relationship is bi-directional. parent object is AFVALSTOF and as example child is OVERBRENGER. the relationship is obligated (not-null="true")
By viewing the hibernate logging i can see that the key field of the child is update to null first but this is an obligated field.
Can anyone help me on how to define my relationship so i can execute the cascade delete?
This is a part of my parent object (AFVALSTOF) which causes
problems
/     private Set overbrenger = new HashSet( );
     * @hibernate.set tablename="overbrenger" lazy="true" inverse="false"
     * cascade="all-delete-orphan"
     * @hibernate.collection-key column="ovbr_afvs_id"
     * @hibernate.collection-one-to-many class="be.milieuinfo.imjv.database.model.afval.Overbrenger"
     * @return Set
     public Set getOverbrenger() {
          return overbrenger;
     * @param overbrenger
     * Overbrenger
     public void setOverbrenger(Set overbrenger) {
          this.overbrenger = overbrenger;
THIS IS THE CHILD (OVERBRENGER) which has a relationship to the PARENT called AFVALSTOF
private Afvalstof afvalstof ;
* @hibernate.many-to-one column="ovbr_afvs_id" class=
     * "be.milieuinfo.imjv.database.model.afval.Afvalstof"
     * not-null="true" inverse="true" cascade="all"
* @return Afvalstof
public Afvalstof getAfvalstof() {
     return afvalstof ;
* @param afvalstof
public void setAfvalstof(Afvalstof afvalstof) {
     this.afvalstof = afvalstof ;
thnx
Stefaan

<?xml version="1.0"?>
  <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="com.orly_otero.patterns.VO.ArticleVO" table="tblArticles">
    <id name="idArticle" type="long">
      <column name="id_Article" not-null="true"/>
      <generator class="native"/>
    </id>
    <property name="title" type="string">
      <column name="Title" length="200" not-null="true"/>
    </property>
    <property name="abstracT" type="string">
      <column name="Abstract" length="2000" not-null="true"/>
    </property>
    <property name="keywords" type="string">
      <column name="Keywords" length="200" not-null="true"/>
    </property>
    <property name="type" type="string">
      <column name="type" length="1" not-null="true"/>
    </property>
    <property name="position" type="integer">
      <column name="position" not-null="false"/>
    </property>
    <property  name="isBriefContribution" type="boolean">
      <column name="isBriefContribution" not-null="false"/>
    </property>
    <many-to-one name="issueVO" column="id_Issue" class="com.orly_otero.patterns.VO.IssueVO" not-null="true"/>
    <set name="authorsVO" table="tlbArticlesAuthors" lazy="true" cascade="save-update">
      <key column="id_Article"/>
      <many-to-many class="com.orly_otero.patterns.VO.AuthorVO" column="id_Author"/>
    </set>
    <set name="sectionsVO" inverse="true" lazy="true" cascade="all" order-by="position ASC">
      <key column="id_Article" not-null="true"/>
      <one-to-many class="com.orly_otero.patterns.VO.SectionVO"/>
    </set>
  </class>
</hibernate-mapping>

Similar Messages

  • Hibernate child cascade delete child???

    i am facing a problem on the cascade delete of a parent object, i try to explain the problem by example.
    Parent object C
    Child object D,E,F
    i want to delete the parent object "delete(c) ".
    before the parent can be deleted the child D,E and F has to be deleted.
    My relations are defined with cascade="all-delete-orphan" in the parent
    object. In my child no cascade is defined.
    When i check the logging on deletion of the object i see that hibernate
    tries to update reference in the child to the parent by setting the value to
    null. But since the the reference is obligated (NOT NULL in database)
    i get a not null constraint violation.
    My first question is why does hibernate not delete the child record instead of updating the reference (since my child object is remove
    from my collection in the parent object)?
    Could some one tell me what i am doing wrong? or does there not exist a solution.
    thnx

    First, is that a typo? The docs for 3.1 that I'm looking at say "all,delete-orphan", but you have "all-delete-orphan".
    Second, I thought (and it's been a long time since I've needed to do this) that you defined the cascading in the child. I could be wrong though.
    What kind of relationship is this? The docs say that delete-orphan only applies to one-to-many.
    You might want to go through the pertinent sections of these if you haven't already:
    http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html
    http://www.hibernate.org/hib_docs/v3/reference/en/html/collections.html
    [url http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#objectstate-transitive]http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#objectstate-transitive

  • Weblogic 9.1, EJB 2.0, Oracle 9i: Cascade delete Error

    Hi All,
    I am facing an error with the cascade-delete facility in ejb2.0 with weblogic 9.1
    Assume that I have the following relation:
    <ejb-relation>
    <ejb-relation-name>TeacherEJB-StudentEJB</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>teacher-has-student
    </ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>TeacherEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>teacher</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>student-has-teacher
    </ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>StudentEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>student</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type><cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now when I have to delete one record from the DBSTUDENT table, what i do is the following:
    StudentHomeLocal.remove(studentModel.getStudentId());
    The above statement throws an SQLException staying it can't update TeacherID in DBSTUDENT (PK of DBTEACHER, FK in DBSTUDENT) with NULL.
    The same code is working perfectly well in Weblogic 8.
    I even tried deleting the local directly by the following statement:
    StudentLocal.remove();
    But this too doesn't work.
    I also tried by removing the <cascade-delete/> attribute from the ejb-jar.xml file and updating the 'on-delete cascade' option in the database, but this too did not work.
    There is another option of <db-cascade-delete> in weblogic-cmp-rdbms-jar.xml that I tried but this too did not work.
    In short, I have tried the following cases but to no avail:
    1. Mention cascade delete in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar and in the database.
    2. Mention nothing in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar but 'on cascade delete' mentioned in the database.
    3. Mention cascade delete in ejb-jar.xml and db-cascade-delete mentioned in weblogic-cmp-rdbms-jar.xml.jar and 'on cascade delete' in the database.
    4. Remove all cascade delete from the ejb-jar.xml,the weblogic-cmp-rdbms-jar.xml and from the database.
    Neither of the above work.
    Kindly help ASAP.
    Thanks in advance,
    Sachidanand.

    Hi All,
    I am facing an error with the cascade-delete facility in ejb2.0 with weblogic 9.1
    Assume that I have the following relation:
    <ejb-relation>
    <ejb-relation-name>TeacherEJB-StudentEJB</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>teacher-has-student
    </ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>TeacherEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>teacher</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>student-has-teacher
    </ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>StudentEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>student</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type><cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now when I have to delete one record from the DBSTUDENT table, what i do is the following:
    StudentHomeLocal.remove(studentModel.getStudentId());
    The above statement throws an SQLException staying it can't update TeacherID in DBSTUDENT (PK of DBTEACHER, FK in DBSTUDENT) with NULL.
    The same code is working perfectly well in Weblogic 8.
    I even tried deleting the local directly by the following statement:
    StudentLocal.remove();
    But this too doesn't work.
    I also tried by removing the <cascade-delete/> attribute from the ejb-jar.xml file and updating the 'on-delete cascade' option in the database, but this too did not work.
    There is another option of <db-cascade-delete> in weblogic-cmp-rdbms-jar.xml that I tried but this too did not work.
    In short, I have tried the following cases but to no avail:
    1. Mention cascade delete in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar and in the database.
    2. Mention nothing in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar but 'on cascade delete' mentioned in the database.
    3. Mention cascade delete in ejb-jar.xml and db-cascade-delete mentioned in weblogic-cmp-rdbms-jar.xml.jar and 'on cascade delete' in the database.
    4. Remove all cascade delete from the ejb-jar.xml,the weblogic-cmp-rdbms-jar.xml and from the database.
    Neither of the above work.
    Kindly help ASAP.
    Thanks in advance,
    Sachidanand.

  • Problem with cascade delete and remove bean

    I am working with two entity beans that map to two tables that have a foreign key relationship. Table B has a foreign key to A and in the database that foreign key is set for cascaded updates and cascaded deletes.
    The problem occurs when the the sytem first tries to remove bean 1 (mapped to table A) and then remove bean 2 (mapped to B) where bean 2 is associated with bean 1 with a foreign key relationship. The first remove works but then when it tries to remove bean 2 it throws a very ugly "CORBA TRANSACTION_ROLLEDBACK 9998" Maybe exception. My guess is that the reason is because bean 2's reocrd in the database was deleted when bean 1 was removed but the 'bean object' was not removed from the container.
    When I go into our Application Server and look at how it see's the tables, it show the wrong relationship. It shows a restrict delete and a restrict update realationship.
    My question is, am I wrong to think that this is a application server problem or a configuration problem? It seems to me that attempting to remove a non-existant record should not cause an error. It won't cause any SQL exceptions. Is this a flawed viewpoint? As a work around I made sure that the dependent records are deleted first but it kind of defeats the point of cascaded deletes.
    We have a limited number of support calls, should I use one or am I at fault here?

    If the database removes the record from the second
    table, why is the system trying to remove it once
    again? You should try to remove an entity from a
    single place, should it be the database or the
    application. Don't try to remove it twice.
    Regards,
    DimitarI could do this but it is a huge pain in my ass. The problem is that you might want to remove the dependent bean without removing it's parent. The object structure is a little questionable, I'll admit that. It is, as they say, the eleventh hour and I can't really change that now.
    The way this work is that the server gets a list of objects marked either as new, modified, or deleted. It then relates those changes back to the database.
    In this case we have two lists(which makes me realize where the class structure sucks.) In order to do what you suggest I would have to get all the deleted parent objects and then search all the deleted child objects for ones that have the parent's key in them.
    It would be prefferable to fix the class structure but again this is not an option.
    Anyone want to answer the question I asked?

  • Foreign keys on cascade delete rules are not migrated

    hello folks, i tried to migrate a database from sql server 2005 to oracle 10g express using SQL Developer 1.5.5 and noticed that the cascade delete option of the foreign keys was ignored by the tool.
    I'd like to know if it's a limitation of the tool or a bug. I have over 500 fks with such configuration and it would be simply impossible to manually configure every migrated fk in oracle.
    thanks all.

    Thanks,
    Already logged:
    Bug 7652822 - ON DELETE CASCADE IS LOST DURING MIGRATION
    -Turloch

  • Cascade deletes in kodo 3.0.1

    I'm trying to use the cascade delete option and am having problems.
    Here is my jdo file:
    <class name="RoomScene" objectid-class="RoomSceneId">
    <extension vendor-name="kodo" key="jdbc-class-map"
    value="base">
    <extension vendor-name="kodo" key="table"
    value="t_roomscene"/>
    <extension vendor-name="kodo" key="pk-column" value="id_i"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column"
    value="rowversion_i"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="id_i"/>
    </extension>
    </field>
    <field name="itemLinks">
    <collection element-type="ItemLink"/>
    <extension vendor-name="kodo" key="element-delete-action"
    value="cascade"/>
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="one-many">
    <extension vendor-name="kodo" key="table"
    value="t_mapitemroomscene"/>
    <extension vendor-name="kodo" key="ref-column.id_i"
    value="roomscene_id_i"/>
    </extension>
    </field>
    </class>
    <class name="ItemLink" objectid-class="ItemLinkId">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t_mapitemroomscene"/>
    <extension vendor-name="kodo" key="pk-column" value="id_i"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="rowversion_i"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id_i"/>
    </extension>
    </field>
    <field name="item">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id_vc" value="item_id_vc"/>
    </extension>
    </field>
    <field name="roomScene">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id_i"
    value="roomscene_id_i"/>
    </extension>
    </field>
    <field name="linkText">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="linktext_vc"/>
    </extension>
    </field>
    </class>
    (each RoomScene has many ItemLinks)
    but when I delete my RoomScene object, I get the following exception:
    "kodo.util.FatalDataStoreException: ERROR: ExecUpdate: Fail to add
    null value in not null attribute roomscene_id_i {prepstmnt 2515391
    UPDATE t_mapitemroomscene SET roomscene_id_i = ? WHERE roomscene_id_i =
    ?} [code=0, state=null]
    NestedThrowables:
    com.solarmetric.jdbc.ReportingSQLException: ERROR: ExecUpdate: Fail to
    add null value in not null attribute roomscene_id_i {prepstmnt 2515391
    UPDATE t_mapitemroomscene SET roomscene_id_i = ? WHERE roomscene_id_i =
    ?} [code=0, state=null]
    java.sql.SQLException: ERROR: ExecUpdate: Fail to add null value in
    not null attribute roomscene_id_i
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:42)
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:24)
    at
    kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:510)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl
    ..java:788)
    at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerI
    mpl.java:644)
    at
    kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:
    416)
    at
    net.mastertile.www.room.action.RoomSceneDeleteAction.executeLogic(RoomSc
    eneDeleteAction.java:27)
    my kodo.properties file is like this:
    javax.jdo.PersistenceManagerFactoryClass:
    kodo.jdbc.runtime.JDBCPersistenceManagerFactory
    javax.jdo.option.RetainValues: true
    javax.jdo.option.RestoreValues: true
    javax.jdo.option.Optimistic: true
    javax.jdo.option.NontransactionalWrite: false
    javax.jdo.option.NontransactionalRead: true
    javax.jdo.option.Multithreaded: false
    javax.jdo.option.MsWait: 5000
    javax.jdo.option.MinPool: 1
    javax.jdo.option.MaxPool: 200
    javax.jdo.option.IgnoreCache: true
    javax.jdo.option.ConnectionFactoryName=java:comp/env/jdbc/default
    javax.jdo.option.ConnectionFactory2Name=java:comp/env/jdbc/default
    kodo.LicenseKey=XXXXXXXXXXX
    kodo.jdbc.MappingFactory=metadata
    kodo.DataCache=false
    kodo.RemoteCommitProvider=sjvm
    kodo.FlushBeforeQueries=false
    kodo.jdbc.ForeignKeyConstraints=true
    kodo.jdbc.SequenceFactory: native
    kodo.jdbc.SchemaFactory: dynamic
    We are using postgresql.
    Thanks,
    Nathan

    Were the foreign keys generated in the database? You also may want to
    try using the *-dependent extensions.
    Nathan Voxland wrote:
    I'm trying to use the cascade delete option and am having problems.
    Here is my jdo file:
    <class name="RoomScene" objectid-class="RoomSceneId">
    <extension vendor-name="kodo" key="jdbc-class-map"
    value="base">
    <extension vendor-name="kodo" key="table"
    value="t_roomscene"/>
    <extension vendor-name="kodo" key="pk-column" value="id_i"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column"
    value="rowversion_i"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="id_i"/>
    </extension>
    </field>
    <field name="itemLinks">
    <collection element-type="ItemLink"/>
    <extension vendor-name="kodo" key="element-delete-action"
    value="cascade"/>
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="one-many">
    <extension vendor-name="kodo" key="table"
    value="t_mapitemroomscene"/>
    <extension vendor-name="kodo" key="ref-column.id_i"
    value="roomscene_id_i"/>
    </extension>
    </field>
    </class>
    <class name="ItemLink" objectid-class="ItemLinkId">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t_mapitemroomscene"/>
    <extension vendor-name="kodo" key="pk-column" value="id_i"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="rowversion_i"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id_i"/>
    </extension>
    </field>
    <field name="item">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id_vc" value="item_id_vc"/>
    </extension>
    </field>
    <field name="roomScene">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id_i"
    value="roomscene_id_i"/>
    </extension>
    </field>
    <field name="linkText">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="linktext_vc"/>
    </extension>
    </field>
    </class>
    (each RoomScene has many ItemLinks)
    but when I delete my RoomScene object, I get the following exception:
    "kodo.util.FatalDataStoreException: ERROR: ExecUpdate: Fail to add
    null value in not null attribute roomscene_id_i {prepstmnt 2515391
    UPDATE t_mapitemroomscene SET roomscene_id_i = ? WHERE roomscene_id_i =
    ?} [code=0, state=null]
    NestedThrowables:
    com.solarmetric.jdbc.ReportingSQLException: ERROR: ExecUpdate: Fail to
    add null value in not null attribute roomscene_id_i {prepstmnt 2515391
    UPDATE t_mapitemroomscene SET roomscene_id_i = ? WHERE roomscene_id_i =
    ?} [code=0, state=null]
    java.sql.SQLException: ERROR: ExecUpdate: Fail to add null value in
    not null attribute roomscene_id_i
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:42)
    at
    kodo.jdbc.sql.SQLExceptions.getFatalDataStore(SQLExceptions.java:24)
    at
    kodo.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:510)
    at
    kodo.runtime.PersistenceManagerImpl.flushInternal(PersistenceManagerImpl
    .java:788)
    at
    kodo.runtime.PersistenceManagerImpl.beforeCompletion(PersistenceManagerI
    mpl.java:644)
    at
    kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:69)
    at
    kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:
    416)
    at
    net.mastertile.www.room.action.RoomSceneDeleteAction.executeLogic(RoomSc
    eneDeleteAction.java:27)
    my kodo.properties file is like this:
    javax.jdo.PersistenceManagerFactoryClass:
    kodo.jdbc.runtime.JDBCPersistenceManagerFactory
    javax.jdo.option.RetainValues: true
    javax.jdo.option.RestoreValues: true
    javax.jdo.option.Optimistic: true
    javax.jdo.option.NontransactionalWrite: false
    javax.jdo.option.NontransactionalRead: true
    javax.jdo.option.Multithreaded: false
    javax.jdo.option.MsWait: 5000
    javax.jdo.option.MinPool: 1
    javax.jdo.option.MaxPool: 200
    javax.jdo.option.IgnoreCache: true
    javax.jdo.option.ConnectionFactoryName=java:comp/env/jdbc/default
    javax.jdo.option.ConnectionFactory2Name=java:comp/env/jdbc/default
    kodo.LicenseKey=XXXXXXXXXXX
    kodo.jdbc.MappingFactory=metadata
    kodo.DataCache=false
    kodo.RemoteCommitProvider=sjvm
    kodo.FlushBeforeQueries=false
    kodo.jdbc.ForeignKeyConstraints=true
    kodo.jdbc.SequenceFactory: native
    kodo.jdbc.SchemaFactory: dynamic
    We are using postgresql.
    Thanks,
    Nathan
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Cascade delete of products in APO

    Hi,
    I´m wondering if there are predefined ways for deleting a product and all it´s dependencies totally in APO. (Cascading deletion). I.e. setting a flag in the product master and getting rid of all connected PPM:s, location/product split, quota arrangements etc etc... Anybody knows how to do this efficiently?
    BR
    Karl

    Hi,
    I wish SAP has provided something like this.
    UNfortunately there is no one button where in you can delete all the dependencies
    Let me list you the steps to my best knowledge
    (1) Supply Chain Engineer --  TRansaction-- /n/sapapo/SCC07
    You can delete most of what you have asked
    Location, LOcation Product, Product, Resource, Trans Lane, PPM
    (2) Remember before this step, you will have to delete all the orders in all versions for this particular product location.
    Use report: /sapapo/rlcdelete to do this.
    Sometimes not all the orders get deleted and when you try to delete the master data in SCEngineer, it will say that there are dependencies.
    Then you would have to use the " WHERE USED LIST" for each master data and then it will display you the order numbers.
    You would have to manually delete each order number using the RLCDELETE report.
    Hope this helps.
    Regards
    Kumar

  • Urgent :: How to do Cascade delete in OA Framework??

    I have built a employeeSearch page. The VO is based on only one EO that is EmployeeEO. This emp_id is referred in 4 other tables.
    what i want to do is ---
    when i delete the employee from employee Search Page. the corresponding records in other tables must get deleted.
    Can i do a Cascade delete over here.
    Please help.

    Use a pl/sql api to do the cascaded delete and call it from OAF.
    --Shiv                                                                                                                                                                                       

  • Privately Owned and Cascade Delete in DB

    HI,
    What is the relationship between setting privately owned in Toplink vs creating a cascade delete in Oracle DB? If I've the cascade delete in DB then what is the advantage of setting the privately owned flag in toplink?
    Thanks

    If you only set the cascade delete option in the database, then TopLink will have no knowledge that the private object was deleted (or that it is private in general). This would mean that TopLink would not remove the private object from the cache or process it as have being deleted. In general this may not cause your app any direct issues if you never read the private object directly as it will eventually garbage collect from the cache.
    Making the relationship privately own in TopLink will also ensure the following:
    - If you replace the private object with another, or set it to null, TopLink will delete the old object on the update of the source. Cascade delete only works on deletion.
    - If the relationship is a 1-m and you remove an object from the collection it will be removed.
    - If you refresh the parent object, by default the child will also be refreshed.
    - If you merge the parent object, by default the child will also be merged.

  • Problem with cascade delete in CMP one-to-one relationship

    I am not able to cascade delete for one-to-one relationship. Even though relationship seems to be setup correctly, record from the second table is not deleted.
    Following is the structure of tables i am using:
    First Table(vcc_lrmc) -- LRMCBean
    lrmc_id pk (Bean field is id)
    lrmc_dtl_id (Bean field islrmcDtlId)
    Second Table (vcc_lrmc_dtl) -- LRMCDetailBean
    lrmc_dtl_id (pk) (Bean field islrmcDtlId)
    lrmc_id (Bean field id)
    One to one bidirectional relationship has been setup with CMR fields moreLRMC and mainLRMC.
    section of ejb-jar is as follows:
    <ejb-relation>
    <ejb-relation-name>LRMCMainToDetail</ejb-relation-name>
    <ejb-relationship-role>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>LRMC</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>moreLRMC</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <multiplicity>One</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>LRMCDetail</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>mainLRMC</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    section of orion-ejb-jar is as follows:(Bidirectional mapping)
    <entity-deployment name="LRMC" data-source="jdbc/VCCDS" table="VCC_LRMC">
    <cmp-field-mapping name="moreLRMC">
    <entity-ref home="LRMCDetail">
    <cmp-field-mapping name="lrmcDtlId" persistence-name="LRMC_DTL_ID"/>
    </entity-ref>
    </cmp-field-mapping>
    </entity-deployment>
    <entity-deployment name="LRMCDetail" data-source="jdbc/VCCDS" table="VCC_LRMC_DTL">
    <cmp-field-mapping name="mainLRMC">
    <entity-ref home="LRMC">
    <cmp-field-mapping name="id" persistence-name="LRMC_ID"/>
    </entity-ref>
    </cmp-field-mapping>
    </entity-deployment>
    Is there anything else need to be setup for Cascade delete or is there anything wrong the way one-to-one relationship has been setup.
    Pls. advice.
    Thanks
    Dhiraj

    Is it happening because of this bug.
    Cannot create a 1:1 bi-directional CMR for entity beans when database tables are reverse engineered. (2447364)
    Anyone, any idea on this ?
    Cheers,
    Dhiraj

  • Cascade delete in privatelyownedrelationships

    If a one-to-many mapping is defined as a privately owned relationship, when I delete a record from this collection, I get integrity constraint exception stating that
    'child record exits', in a privately owned collection, dont the child records get deleted automatically,
    We are removing a record from the collection and trying a commit thru UOW. thanks

    Looks like a bug in the way the cascade delete is being done, if we remove the constraints then the cascade delete works.

  • Cascade delete in many to many association

    Hi All,
        I have a usecase, there is an association with many to many cardinality  between 3 EO's. If i delete  any record in master, the corresponding childs all should delete.
        So appreciate if any alternatives on above usecase. Thanks in advance

    Hi,
    cascade delete is a function of the database. When you enable cascade delete for an entity operation then this only produces the proper SQL code for deleting a data object. If you have a many-to-many relation then this means you have multiple master and child records, which I think makes your "If i delete  any record in master, the corresponding childs all should delete" impossible.
    for what its worth, please read
    Creating a Business Domain Layer Using Entity Objects - 11g Release 2 (11.1.2.3.0)
    to learn how to parse and delete detail records  from an entity object
    http://docs.oracle.com/cd/E35521_01/web.111230/e16182/bcentities.htm#CEGJAFCF
    The last document is about posting orders (e.g. create a master record before you create detail records). However, with a few changes you can reverse this to perform a delete operation (just add this code to the entity impl classes of the entities so they delete their child objects
    Frank

  • Cascade delete in CMP 1:M relationship

    All,
    I have 2 CMP entity beans with 1:M relationship and cascade delete option setup. All functions of Add/Mod are working fine.
    Even cascade delete is getting trigged but not executing properly every time. Out of more than 100 records in the child table, only 99 are getting cascade deleted. I am deploying the beans using embedded OC4J which comes with JDeveloper.
    Is anyone aware of any such limitations or faced similar problem before ? Database tables don't have any integrity constraint setup.
    Thanks,
    Dhiraj

    The problem is that by making the AddrXRef privately owned it cannot be reparented. Once it is removed from it's parent's list (either one) it will be deleted. To achieve what you're trying to do you'll need to delete the old incorrect AddrXRef and replace it with a new correct one.
    From the TopLink Developer's Guide[1]:
    When you tell TopLink that a relationship is privately owned, you are specifying that:
    * If the source of a privately owned relationship is deleted, then delete the target.
    * If you remove the reference to a target from a source, then delete the target.
    --Shaun
    [1] http://www.oracle.com/technology/products/ias/toplink/doc/10131/main/_html/uowbas007.htm#i1134011

  • Let the database doing cascade deletion for privateOwned relationship

    Hi,
    I have two tables: parent, child. I mapped the parent to child as a one-many private owned relationship. The child table have a foreign key reference back to parent table. The constraint is like this
    alter table child add constraint FK_CONSTRAINT foreign key (parentid) reference parent (parentid) on delete cascade;
    I would the cascade deletion is done by database (as it is "on delete cascade" in the constraint) rather by the toplink. (This is exactly what you will do when use JDBC. another reason is that if I let the TopLink do the cascade deletion, I got a deadlock! If I remove the cascade deletion from topLink, I do not have the deadlock).
    Is there anyway I can turn off the cascade deletion from topLink, but at the same side keep the private owned relationship(because it is indeed privately owned)?
    Any help is really appreciated.
    jason

    Setting a no-op sql solves the cascade deletion problem. However, if I really want to remove a child from the parently, I ends up using the same no-op sql. I can not delete child independently.

  • Cascade Delete thru Cross-Reference Table?

    I'm setting up cascade delete rules in my database and I wonder if there's a way to cascade delete through a cross-reference table?
    I have a table: "projects" that can have many "tasks" (also a table). A "participation" table is the cross-reference between them and it holds other information about the relationship.
    So I know I can do a cascade delete so that the participations will get deleted when either the project or the task get deleted, but can I rig something so that when I delete a project all the participations and tasks get deleted?
    Quick answers are greatly appreciated,
    Janice

    I recommend you to post this topic as well here:
    Forums Home » Oracle Technology Network (OTN) » Products » Database » SQL and PL/SQL
    Discussion of Oracle SQL and PL/SQL issues
    PL/SQL
    Joel Pérez

Maybe you are looking for

  • How to connect Macbook to 23" Cinema Display

    I just bought a Mini-DVI to VGA adapter to connect my Macbook to my Cinema Display 23", but I am realizing this adapter is probably not what I need as the Cinema HD Display has a different, larger connector that doesn't match the other end of my adap

  • What is the meaning of "PSEUDO" and "NONE" in v$session table.

    Hi What is the meaning of "PSEUDO" and "NONE" in v$session table. V$SESSION: SERVER      VARCHAR2(9)      Server type (DEDICATED| SHARED| PSEUDO| NONE) thanks siva

  • Can I use autofill - but reserve space on iPhone for non-music ?

    Hi I would like to autofill my Iphone with music but reserve space on the Iphone for other media.  It seems it used to be possible, but I can't find it anymore on Itunes 11 on my Imac.  Any help? THanks! Mike

  • Settlement cost element

    Dear All, I have settlement defined in pa transfer structure, if at the same time I have more than 1 cost element to settle to different value field in copa, can the secondary cost element in settlement able to settle 2 or 3 different cost element to

  • Programatic import can't clear out a property of data-type="set"

    Our catalog repository has a item-descriptor for a "sku" that has a property named "modelProfiles" which is a data-type="set". This allow our SKUs to have a one-to-many relationship with ModelProfile components. We programmatically import and update