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

Similar Messages

  • (Kodo 4.1); DELETE issued even with @ForeignKey cascade delete?

    I'm wondering if anyone has seen this.
    I'm using Kodo 4.1, and MySQL, and I basically have the following situation (default generated IDs omitted):
    Code:
    @Entity
    public class A {
      @OneToMany(mappedBy="a", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
      private Set<BB> bMany = new HashSet<BB>();
    @Entity
    public class BB {
    @ManyToOne(cascade={CascadeType.PERSIST, CascadeType.REFRESH })
    @JoinColumn(name = "A_ID")
    @ForeignKey(deleteAction=ForeignKeyAction.CASCADE)
    private A a;
    Schema:
    CREATE TABLE BB(
      A_ID BIGINT NOT NULL,
      CONSTRAINT FOREIGN KEY (A_ID) REFERENCES A(ID) ON DELETE CASCADE
    ) ENGINE=InnoDB;OK. I create an A with a couple of BBs in it, and persist it. Everything's fine. Now I call entityManager.remove() on the A instance I persisted, and I can see it issuing DELETE commands for BB after the DELETE for A, which produces an OptimisticLockException. I'd have hoped that the above @ForeignKey would have told Kodo not to issue such commands, knowing that the DB would do it.
    Any insight? Have I used @ForeignKey correctly (examples seem sparse in the documentation)? Is there a workaround, other than removing the cascade delete and doing deletions manually from code?
    Thanks,
    -- Bryan Loofbourrow

    1. Kodo needs to know the constraints set on mapped columns.
    Set the following properties in your configuration
    kodo.jdbc.SchemaFactory:native(ForeignKeys=true)
    2. Are you explictly setting kodo.jdbc.UpdateManager property?

  • Cascade delete problem(1+n call)

    Hi Kodo Team.
    I have two objects(one-many).
    When I delete object, cascade delete works good.
    But Kodo generates n+1 call.
    Is this right?
    As I know, Kodo generates just 1 call when I call one-many load.
    Is there any way to only one call for delete?
    my setting is below.
    <jdo>
    <package name="ep.prm.schedule.entity">
    <class name="Schedule" objectid-class="SchedulePK">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="pk-column" value="SCHCODE"/>
    <extension vendor-name="kodo" key="table"
    value="EPSCHEDULE.SC_TSCHEDULE"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="JDOVERSION"/>
    </extension>
    <!-- many sides-->
    <field name="receivers" persistence-modifier="persistent">
    <collection element-type="Receiver"/>
    <extension vendor-name="kodo" key="fetch-group" value="receiver"/>
    <extension vendor-name="kodo" key="inverse-logical" value="schedule"/>
    <extension vendor-name="kodo" key="element-dependent" value="true"/>
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-many">
    <extension vendor-name="kodo" key="table"
    value="EPSCHEDULE.SC_TRECEIVER"/>
    <extension vendor-name="kodo" key="ref-column.SCHCODE"
    value="SCHCODE"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>

    Thanks for your help.
    I said a separate delete statement.
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Leejungryong-
    Are you saying that Kodo will issue a separate delete statement for each
    object that is deleted? If so, then that is expected behavior. Note that
    batch support in Kodo should make those statements all be executed in a
    single batch, so it isn't as much of a performance penalty as it might
    first appear (provided you have a Performance Pack or Enterprise Edition
    license).
    If you mean something else by "Kodo generates n+1 call", can you
    clarify? Is it issuing multiple separate selects or something? Some
    logging output might help provide some more insight.
    In article <[email protected]>, Leejungryong wrote:
    Hi Kodo Team.
    I have two objects(one-many).
    When I delete object, cascade delete works good.
    But Kodo generates n+1 call.
    Is this right?
    As I know, Kodo generates just 1 call when I call one-many load.
    Is there any way to only one call for delete?
    my setting is below.
    <jdo>
    <package name="ep.prm.schedule.entity">
    <class name="Schedule" objectid-class="SchedulePK">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="pk-column" value="SCHCODE"/>
    <extension vendor-name="kodo" key="table"
    value="EPSCHEDULE.SC_TSCHEDULE"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="JDOVERSION"/>
    </extension>
    <!-- many sides-->
    <field name="receivers" persistence-modifier="persistent">
    <collection element-type="Receiver"/>
    <extension vendor-name="kodo" key="fetch-group" value="receiver"/>
    <extension vendor-name="kodo" key="inverse-logical"
    value="schedule"/>
    <extension vendor-name="kodo" key="element-dependent" value="true"/>
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-many">
    <extension vendor-name="kodo" key="table"
    value="EPSCHEDULE.SC_TRECEIVER"/>
    <extension vendor-name="kodo" key="ref-column.SCHCODE"
    value="SCHCODE"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>
    Marc Prud'hommeaux
    SolarMetric Inc.

  • Cascade delete not working

    Hi,
    I can't seem to get cascade deleting to work even though I've set it up on
    the db side (SQL Server 2000)as well as follow the documentation to use
    the dependendent extension:
    From my 'package.jdo':
    <package name="test">
    <class name="Person" objectid-class="Person$ID" >
    <field name="personId" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PersonId"/>
    </field>
    <field name="addresses" default-fetch-group="true">
    <collection element-type="Address"/>
    <extension vendor-name="kodo" key="element-dependent"
    value="true"/>
    </field>
    </class>
    <class name="Address" objectid-class="Address$ID" >
    <field name="personId" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PersonId"/>
    </field>
    <field name="addressId" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="AddressId"/>
    </field>
    </class>
    </package>
    When I run the following code:
    Person.ID id = new Person.ID("" + 3);
    object = persistenceManager.getObjectById(id,false);
    if (object != null) {
    persistenceManager.currentTransaction().begin();
    persistenceManager.deletePersistent(object);
    persistenceManager.currentTransaction().commit();
    I get this exception:
    com.solarmetric.jdbc.ReportingSQLException: [MYDB]Incorrect syntax near
    the keyword 'WHERE'. {prepstmnt 6504030 UPDATE dbo.Address SET  WHERE
    PersonId = ? [params=(int) 5] [reused=0]} [code=156, state=01000]
    It looks like Kodo is trying to do an update on the dependent object,
    instead of a delete. Any ideas?
    D. May

    I got the same error even after changing the package.jdo to the following:
    <package name="org.uscentral.webach.domain.test">
    <class name="Address" objectid-class="Address$ID" >
    <field name="personId" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="PersonId"/>
    </field>
    <field name="addressId" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="AddressId"/>
    </field>
    </class>
    <class name="Person" objectid-class="Person$ID" >
    <field name="personId" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="PersonId"/>
    </field>
    <field name="addresses" default-fetch-group="true">
    <collection element-type="Address"/>
    <extension vendor-name="kodo" key="jdbc-delete-action"
    value="cascade"/>
    </field>
    </class>
    </package>
    Marc Prud'hommeaux wrote:
    Darrin-
    If you have cascade deletion happening on the server-side, they you want
    to use the "jdbc-delete-action" extension to notify Kodo of this, rather
    than the "dependent" extension (which tells Kodo to perform client-side
    cascading deletion).
    In article <[email protected]>, Darrin May wrote:
    Hi,
    I can't seem to get cascade deleting to work even though I've set it up on
    the db side (SQL Server 2000)as well as follow the documentation to use
    the dependendent extension:
    From my 'package.jdo':
    <package name="test">
    <class name="Person" objectid-class="Person$ID" >
    <field name="personId" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PersonId"/>
    </field>
    <field name="addresses" default-fetch-group="true">
    <collection element-type="Address"/>
    <extension vendor-name="kodo" key="element-dependent"
    value="true"/>
    </field>
    </class>
    <class name="Address" objectid-class="Address$ID" >
    <field name="personId" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PersonId"/>
    </field>
    <field name="addressId" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="AddressId"/>
    </field>
    </class>
    </package>
    When I run the following code:
    Person.ID id = new Person.ID("" + 3);
    object = persistenceManager.getObjectById(id,false);
    if (object != null) {
    persistenceManager.currentTransaction().begin();
    persistenceManager.deletePersistent(object);
    persistenceManager.currentTransaction().commit();
    I get this exception:
    com.solarmetric.jdbc.ReportingSQLException: [MYDB]Incorrect syntax near
    the keyword 'WHERE'. {prepstmnt 6504030 UPDATE dbo.Address SET  WHERE
    PersonId = ? [params=(int) 5] [reused=0]} [code=156, state=01000]
    It looks like Kodo is trying to do an update on the dependent object,
    instead of a delete. Any ideas?
    D. May
    Marc Prud'hommeaux
    SolarMetric Inc.

  • 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 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 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>

  • 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

Maybe you are looking for

  • Cisco Jabber for windows directory issue

    Hello , i have cucm 9x and cup 9.x , Cisco jabber is showing directory but its all user from MS out look User not LDAP user and also user and on Jabber client connection window Directory is showing not connected . please advise .

  • Drop Down List not getting populated

    Dear All, I have developed a form in SFP which containes a drop down list.The drop down list is to be populated by an internal table field. Whenever I am executing the form i can see only the first item in the drop down listand nothing else. While de

  • Ipod won't sync to my laptop!!!!!!!!!!!

    I downloaded songs to my old computer and then i got a lap top so i tried to get all the songs from my ipod to my lap top but it won't let me sync the purchased songs... what do i do?

  • Yahoo! Mail won't send from my iPhone since installing iOS 5

    Hi, I have just upgraded to iOS 5 on my iPhone 3GS. I am not using iCloud. (The issue I am about to describe, or something similar, seems to be reported by iCloud users elsewhere in this forum, but I think the causes are different.) I synced my mail

  • When I click the MFF desktop icon Firefox takes exactly 30 seconds to load, is that right?

    ''Duplicate post, continue here -'' [/questions/752057] I have just installed Firefox and it takes 30s from clicking the desktop icon to loading the home page. Tabs only take about 2s, is this right? IE loads in 2-3 s.