Is editing also possible like the cascade delete. in ADF

Hi
I am trying to achieve following requirement.
2)     For a valid edit equipment scenario:-
a. When we increase the equipment count (i. e. availability_count), corresponding equipment instances should also be increased in the T_EQUIPMENT_INSTANCE.
b. When we decrease the equipment count (i.e. availability_count), corresponding equipment instances should also be decreased in the T_EQUIPMENT_INSTANCE.
Here I have two table in DB Viz. T_special_equipment(equipment_id,equipment name, equipment_desc, ...., availability_count) , here equipment _id is generated through the sequence i.e. not getting value from the portal
there is another table T_equipment_instance(Equipment_id, Instance_id) in this table instance_id is generated through sequence.
**Here say currently I have availability_count =3 for equipment_id 100 in T_special_equipment table then this Equipment id would be appearing 3 times in Tequipment_instance table ,** so while perfrming edit operation on
T_special_equipment table and say decreasing availability_count =2 , so correcsponding Equipment id should appeare 2 times in Tequipment_instance table
and suppose while perfrming edit operation on T_special_equipment table and say increasing availability_count =6 , so correcsponding Equipment id should appeare 6 times in Tequipment_instance table
Can anyone please give some suggetions on it, How can I achieve this.

Lets try again:
Start withT_EQUIPMENT_INSTANCE
Row equipment_id        equipment name ....  availability_count
1   1                   Test                 5
T_equipment_instance
Row    Equipment_id        Instance_id
1      1                   100
2      1                   101
3      1                   102
4      1                   103
5      1                   104set availability_count to 3
T_EQUIPMENT_INSTANCE
Row equipment_id        equipment name ....  availability_count
1   1                   Test                 3
T_equipment_instance
Row    Equipment_id        Instance_id
1      1                   100
4      1                   103
5      1                   104or may be
T_EQUIPMENT_INSTANCE
Row equipment_id        equipment name ....  availability_count
1   1                   Test                 5
T_equipment_instance
Row    Equipment_id        Instance_id
3      1                   102
4      1                   103
5      1                   104or T_EQUIPMENT_INSTANCE
Row equipment_id        equipment name ....  availability_count
1   1                   Test                 5
T_equipment_instance
Row    Equipment_id        Instance_id
2      1                   101
3      1                   102
4      1                   103You see the problem?
You need to specify exactly which rows to delete.
In text: "when availability_count decrements delete as many rows in table T_equipment_instance matching the Equipment_id with the highest instance_id until the count of rows equals the availability_count"
or "when availability_count decrements delete as many rows in table T_equipment_instance matching the Equipment_id with the lowest instance_id until the count of rows equals the availability_count"
or "when availability_count decrements delete as many rows matching the Equipment_id until the count of rows equals the availability_count"
This a use case you can code against.
Next thing is that you said that you use a sequence to fill the instance_id. One feature of a db sequence is that you get each number only once. So when you decrement the availability_count and delete the highest numbers and then increment the availability_count again the instance id has gaps.
Timo

Similar Messages

  • How to make a select list editable or searchable like the combobox

    Does anybody know, How to make a select list editable or searchable like the combobox? Do we need a plugin here, where I can get it.

    Hi Nilesh,
    If this is what you are looking for http://apex.oracle.com/pls/apex/f?p=32395:3:1202144397644679
    get the combobox plug-in
    http://www.apex-plugin.com/oracle-apex-plugins/item-plugin/searchable-combobox.html
    I have not tried this though. Found it while searching for some other plug-ins.
    Regards,
    -Senthil

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

  • Virtual private database and cascade delete

    We can't secure rows deleted by cascade delete by vpd.
    User "A" have right to delete row "1" but don't have right to delete row "2".
    If user "A" delete row "1", database will delete also row "2" by cascade delete.
    Why it is possible to delete row "2"?

    Either of the two options (a policy that queries the base table or propagating the security columns to the child tables) should work.
    My preference from a data model standpoint would be to have a policy that queries the base table so that the security information can be maintained in exactly one place. But if your application is frequently querying the child tables without reference to the parent table, joining to the parent table, particularly if data volumes are such that an IN would be less than ideal, there may be performance issues to this approach.
    Copying the columns creates a potential data integrity problem-- if you change the security on a base table row, you may forget to change the security on all the child records. But that issue may not be significant if the security is essentially static once the rows are created. And it's definitely easier to tune.
    You may also want to create views that join the parent and child tables and grant users access to these views rather than to the child tables directly, which would allow you to have a single policy on the base table and get most of the benefits of the first option with less performance problems if data volumes make an IN less than ideal.
    Justin

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

  • 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

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

  • 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 container or database schema?

    I am creating a database schema which I want to map EJB CMP Entity Beans onto. There are a number of relationships in the schema where I want to cascade deletion if a parent record is deleted and a number of relationships where I want to prevent deletion of parent records if child records exist for the relationship.
    I am wondering whether it is better to implement this in the database schema (Oracle) or in the container (JBoss 3.2.2)? I believe it is possible to implement cascading delete in the container but I am not sure about preventing delete in the container? Is there a way I could do it programmatically? I want to use CMP though so I'm not sure there would be much scope for that.
    Are there any rules as to which approach is better? Will the container have a problem if I implement it in the database schema? Obviously the ejbRemove may throw an exception if I prevent deletion in a relationship but that is fine. I believe it is not a good idea to implement it in both the container and schema as there will be a conflict when they both try to delete records.
    Thanks.

    Container's cascade-deleting in jboss(tm)3.2.x working properly with any scope:
    This example with 1 scope:
        <relationships>
            <ejb-relation>
                <ejb-relation-name>Region-Town</ejb-relation-name>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>region-has-towns</ejb-relationship-role-name>
                    <multiplicity>One</multiplicity>
                    <relationship-role-source>
                        <ejb-name>RegionBean</ejb-name>
                    </relationship-role-source>
                    <cmr-field>
                        <cmr-field-name>regionTowns</cmr-field-name>
                        <cmr-field-type>java.util.Set</cmr-field-type>
                    </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>town-belongs-to-region</ejb-relationship-role-name>
                    <multiplicity>Many</multiplicity> <cascade-delete/>
                    <relationship-role-source>
                        <ejb-name>TownBean</ejb-name>
                    </relationship-role-source>
                    <cmr-field>
                        <cmr-field-name>region</cmr-field-name>
                    </cmr-field>
                </ejb-relationship-role>
            </ejb-relation>
        </relationships>

  • [EJB:010142] error for cascade-delete

    Hi,
    I'm getting [EJB:010142] error (Instance of EJB <relatedEJB> with primary key <pk> does not exist) while trying to implement a straight-forward cascade-delete option in ejb-jar.xml for a one-to-many relationship using EJB 2.1.
    While the cascade-delete works well for a one-to-one relationship, it is throwing this error for one-to-many relationship.
    DB used is Oracle 10g XE. Server is Weblogic 9.2 MP4.
    Given below the exact error:
    javax.ejb.EJBException: EJB Exception:: java.lang.IllegalArgumentException: [EJB:010142]Instance of EJB 'LineItem' with primary key 'li8' does not exist.
         at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.remove(Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.java:531)
         at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.remove(Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.java:496)
         at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.clear(Order_cpl9bk__WebLogic_CMP_RDBMS_lineItems_Set.java:369)
         at Test1.Order_cpl9bk__WebLogic_CMP_RDBMS.__WL_superEjbRemove(Order_cpl9bk__WebLogic_CMP_RDBMS.java:1667)
         at weblogic.ejb.container.manager.DBManager.remove(DBManager.java:1664)
         at weblogic.ejb.container.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:125)
         at Test1.Order_cpl9bk_ELOImpl.remove(Order_cpl9bk_ELOImpl.java:577)
         at jsp_servlet.__cascadedeletetest._jspService(__cascadedeletetest.java:198)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3272)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2019)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1925)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1394)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    ; nested exception is: java.lang.IllegalArgumentException: [EJB:010142]Instance of EJB 'LineItem' with primary key 'li8' does not exist.
         at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
         at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:657)
         at weblogic.ejb.container.internal.BaseEJBLocalHome.handleSystemException(BaseEJBLocalHome.java:150)
         at weblogic.ejb.container.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:132)
         at Test1.Order_cpl9bk_ELOImpl.remove(Order_cpl9bk_ELOImpl.java:577)
         at jsp_servlet.__cascadedeletetest._jspService(__cascadedeletetest.java:198)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3272)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2019)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1925)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1394)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    I have verified that the lineitem record that it is trying to delete is existing in the db table.
    Please let me know what could be the possible issue.
    Thanks,
    Vinod

    Any ideas yet???
    Is there any knowledgebase (KB) article to read about this???

  • 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                                                                                                                                                                                       

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

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

  • 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

Maybe you are looking for

  • Mail, Address Book and Numbers integration

    I have a large database of names and addresses in Numbers. The fields are custom fields because of the nature of the data. I want to scoop the whole lot across to a custom group in Address Book, so that I can send group emails. I can export the data

  • Library problem

    Hi All! I am facing a problem in library issue if i change the procedure in library then i need to recompile the all forms or detach and re attach the library again. Pls help me.

  • IDVD asks repeatedly to authorize computer to play audio from iTunes

    Everytime I try to add an audio file from my iTunes library to my iDVD menu, it asks me to authorize the computer. So I authorize the computer but it never adds the audio. So I drag the audio clip again to where I want it to play, and it asks me to a

  • When will podcasts be fixed in iTunes 11?

    What a collosal cluster fck this version is.  The automatic link to what could be downloaded just clutters up the items folks are currenty interested in, then the new implementation of autoplay is not user friendly for anyone I know of. So when will

  • How to install Expense manager

    Thanks for Helping to install Expense manager on my 6234.