Master-Detail and Auto Insert Detail rows

Apex 3.0
I'm trying to do a Master-Detail form. I have it set to stay on the same page when I Create a new Master Record.
Now, what I would like to do is auto insert data into the Detail Rows some predefined information and have it ready for the user to enter the rest of the information. I did this by creating a Page Process to trigger on the Add Row button for the Details region. The code I used is:
begin
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'General');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Automobile');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Excess');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Workers Comp');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Others (Builders Risk)');
end;
P7_Contract_ID is the PK on the Master table and I predefine the Insurance Type. The rest of the table the user is able to enter as needed.
When I run it, the new rows show up but the Insurance Type is NULL and browsing from one record and back the new rows are gone. It seems like the PK for the Detail rows are not being filled. I have a Sequence Trigger set to fire on Update:
CREATE OR REPLACE TRIGGER "BI_PURCH_INSURANCE_TYPE"
before insert on "PURCH_INSURANCE_TYPE"
for each row
begin
if :NEW."INSURANCE_TYPE_ID" is null then
select "PURCH_INSURANCE_TYPE_SEQ".nextval into :NEW."INSURANCE_TYPE_ID" from dual;
end if;
end;
ALTER TRIGGER "BI_PURCH_INSURANCE_TYPE" ENABLE
What am I missing? Any ideas or suggestions?

Hi All!
I think there is no solution to this problem, only single selection is the solution.
If any one has anyother solution plz let me know.
Thanks and regards.
Abbasi

Similar Messages

  • Creating master detail rows

    using adf/bc with jsf. I have defined a master detail relationship between two entities. This relationship is a composition relationship. The entities are related by a view link which link the master and detail view objects. i have a need to create/insert a master row and a detail row programmatically "on the fly" so that when the jsp renders, the user will see blank inputs for both the master and detail view objects. The problem is that the primary key of the master record is not known at creation time ( it will be entered by the user) and therefore the detail record cannot be created by the framework because of the unknown value of the parent's primary key. I was hoping the following section in the adf guide would eliminate my problem, but it doesn't appear to:
    This is from section 26.7.3.2 of the adf developer's guide
    Note: An alternative to the programmatic technique discussed
    above, which solves the problem at the J2EE application layer, is the
    use of deferrable constraints at the database layer. If you have control
    over your database schema, consider defining (or altering) your
    foreign key constraints to be DEFERRABLE INITIALLY DEFERRED.
    This causes the database to defer checking the constraint until
    transaction commit time. This allows the application to perform DML
    operations in any order provided that by COMMIT time all appropriate
    related rows have been saved and would alleviate the parent/child
    ordering described above. However, you would still need to write the
    code described in the following sections to cascade-update the foreign
    key values if the parent’s primary key is assigned from a sequence.
    This approach did not help in allowing me to create the detail record without first knowing the value of the parent's primary key record in a composition relationship. The only thing i've found to work is define the relationship as just an association, and not a composition. However, this is a true one to many (composition) relationship and i would like to take advantage of some of the features of the framework that are there when a relationship is defined as a composition relationship. Is there any way to do what i need to do with a composition relationship defined between these two entities? Thanks.

    Hi,
    I guess you need a "Cascading LOVs".
    1) Create viewObject for country values list. Named VO1.
    2) Create viewObject for state values list. Named VO2.
    3) Create view criteria for (bind variable) VO2 which can restrict the result by country.
    4) Create view accessor to get VO1.
    5) Create view accessor to get VO2. Define the bind variable value which can provide country info dynamically. I guess it should be a Groovy expression.
    6) Create country LOV on step 4) view accessor.
    7) Create state LOV on step 5) view accessor.
    Done
    On the view layer, you may enable PPR between country and state attributes.
    Todd

  • Delete and Re-Insert a Row in the Same Statement

    Hello to all,
    I have to do a row Update of 2-3 columns, but due to my Triggers(delete and Insert) and unique index, I would like for same row one delete and one Insert of the columns modified,
    is it possibile in same(single) statement do this?
    That is,instead to do
    Update table1 set col3 = '6';
    I should do
          DELETE FROM  table1
          WHERE
    INSERT INTO table1
          SELECT col1,col2  ,'6'
         FROM table1
          WHERE -----thanks in advance
    Edited by: Rosario Vigilante on Mar 5, 2012 11:18 AM

    first of all thanks for your answer and your time,
    I already have 2 Triggers (OF delete and insert) that work well, when they fire they run a stored procedure that inserts rows into another table,
    ie, both triggers on the table 1 write rows on Table 2, more or less what happens in an audit table.
    Anyway thanks again

  • Insert Master Detail

    Hi all,
    I need to understand which is the fastest way for inserting rows in master-detail tables
    Using a procedure. I often insert lots of details rows and sometimes master-details rows
    Here there is my solution. Is there something faster?
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    CREATE TABLE MAIN_TRACING (
       MAINVAL VARCHAR2(10) NOT NULL,
       PAR1    VARCHAR2(10) NOT NULL);
    CREATE TABLE TRACING_DET (
       MAINVAL   VARCHAR2(10) NOT NULL,
       SUBPAR1   VARCHAR2(10) NOT NULL);
    CREATE UNIQUE INDEX MYPK ON MAIN_TRACING(MAINVAL);
    ALTER TABLE MAIN_TRACING ADD ( CONSTRAINT MYPK PRIMARY KEY (MAINVAL) USING INDEX MYPK);
    ALTER TABLE TRACING_DET ADD ( CONSTRAINT MYFK FOREIGN KEY (MAINVAL)  REFERENCES MAIN_TRACING (MAINVAL));
    CREATE OR REPLACE PROCEDURE ADD_TRACE(V_MAINVAL VARCHAR2, V_PAR1 VARCHAR2, V_SUBPAR1 VARCHAR2)
    AS
       PARENT_NOT_FOUND   EXCEPTION;
       PRAGMA EXCEPTION_INIT(PARENT_NOT_FOUND, -2291);
    BEGIN
       INSERT INTO TRACING_DET(MAINVAL, SUBPAR1)
            VALUES (V_MAINVAL, V_SUBPAR1);
       COMMIT;
    EXCEPTION
       WHEN PARENT_NOT_FOUND
       THEN
          INSERT INTO MAIN_TRACING(MAINVAL, PAR1)
               VALUES (V_MAINVAL, V_PAR1);
          INSERT INTO TRACING_DET(MAINVAL, SUBPAR1)
               VALUES (V_MAINVAL, V_SUBPAR1);
          COMMIT;
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.PUT_LINE(' Error code    : ' || TO_CHAR(SQLCODE));
    END ADD_TRACE;
    EXEC ADD_TRACE('m1', 'a', 'suba1');
    EXEC ADD_TRACE('m1', 'a', 'suba2');
    EXEC ADD_TRACE('m1', 'a', 'suba3');
    --exec ADD_TRACE('m1', 'b', 'suba3'); --IMPOSSIBLE!
    EXEC ADD_TRACE('m2', 'b', 'subb1');
    EXEC ADD_TRACE('m2', 'b', 'subb2');
    SELECT * FROM MAIN_TRACING;
    MAINVAL    PAR1
    m1         a
    m2         b
    SELECT * FROM TRACING_DET;
    MAINVAL    SUBPAR1
    m1         suba1
    m1         suba2
    m1         suba3
    m2         subb1
    m2         subb2

    The answer (as Tom Kyte is fond of stating) is "It depends" ;-)
    Is this something that is called scattered over the application? Most of the time it will be called with an existing MAINVAL and just sometimes now and again a new MAINVAL will be inserted? Subsequent calls to ADD_TRACE will typically have a different MAINVAL than the previous call?
    If that is the case, then your method is not a bad one. Many programmers would have first tested for existence of master and decided whether to insert it or not, which would then be wasted effort in 95% of the cases.
    Your method of assuming the master exists and then handle the exception if it does not - that is quite neat. But the key is - it has to be the exception to the rule that the exception handler is invoked.
    But if on the other hand you are calling ADD_TRACE pretty consecutively (sort of like your example) with first several calls with one MAINVAL, then several calls with a new MAINVAL, then several with a new MAINVAL, etc. - say a typical ETL process or loading data from perhaps a flatfile or something like that - then you would do better to do one insert of the parent and then bulk up the children in a bulk insert.
    So it depends on your use case. There is not one generally best way to insert into master-detail - there will be several depending on whether you are bulk loading data to your master-detail or you have scattered calls.
    But just one other thing concerning your code:
    Usually it is not a good idea to issue those COMMIT statements inside your procedure. How do you know if the caller has finished with the transaction or not?
    Either let the client/caller decide when the complete transaction is done.
    Or you may decide that this is tracing/logging and should be logged no matter whether the calling transaction commits or rollbacks, and then you can make ADD_TRACE use an autonomous transaction.
    (All of the above is just my personal opinion and you will likely find other people with different opinions ;-) )

  • Master-detail page: insert in detail not working

    Hello JHeadstart Team,
    I'm using jdev 10.1.3.2.0 and jhs 10.1.3.1.26.
    I have a master-detail page (master = table-form layout and (on same page) detail = table layout).
    If starting the page, pushing the new master record button, inserting a new master record and finally inserting a new detail record following error occurs:
    07/05/02 14:50:30 [720] (16) DCBindingContainer.reportException(220) DCBindingContainer.reportException :oracle.jbo.TxnValException
    07/05/02 14:50:30 [721] (16) Diagnostic.printStackTrace(410) oracle.jbo.TxnValException: JBO-27023: Validieren aller Zeilen in einer Transaktion nicht möglich.
    and for every mandatory column in the detail
    ## Detail 0 ##
    oracle.jbo.RowValException: JBO-27027: Fehlende obligatorische Attribute für eine Zeile mit dem Schlüssel oracle.jbo.Key[-5 ] vom Typ Quellen
         at oracle.jbo.server.JboMandatoryAttributesValidator.validate(JboMandatoryAttributesValidator.java:118)
    There is also a warning in the embedded OC4J log
    02.05.2007 14:49:26 oracle.adfinternal.view.faces.model.binding.FacesCtrlRangeBinding$FacesModel getSelectedRow
    WARNUNG: rowIterator is null
    If I query the data first I can insert master and detail records as exspected! The same if the details are placed on a separate page!
    Trying to use the new feature AddRow-Button for table layout gives ALLWAYS
    500 Internal Server Error (
    javax.faces.el.EvaluationException: java.lang.NullPointerException     
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)     
    at oracle.adf.view.faces.component.UIXComponentBase.__broadcast(UIXComponentBase.java:1087)     
    at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:204)     
    at oracle.adf.view.faces.component.UIXCollection.broadcast(UIXCollection.java:95)     
    at oracle.adf.view.faces.component.UIXTable.broadcast(UIXTable.java:208)     
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)     
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)     
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)     
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)     
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)     
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)     
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:162)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)     
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:228)     
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:197)     
    at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:123)     
    at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:103)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:620)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:369)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:865)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:447)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:215)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)     
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)     
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)     
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)     
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.1.1) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)     
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.NullPointerException     
    at oracle.jheadstart.controller.jsf.bean.JhsCollectionModel.addRow(JhsCollectionModel.java:443)     
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)     
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     
    at java.lang.reflect.Method.invoke(Method.java:585)     
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)     
    ... 30 more
    In the ADF BC Tester the application module runs properly.
    How can I debug?
    Is there something wrong in the model level or view level?
    Thanks in advance
    Peter

    Thanks Menk for your idea!
    I located the source of the problem in the pagedef:
    After changing the RefreshCondition of the Detail Iterator from
    <iterator id="DETAILIterator" Binds="DETAILView1"
    DataControl="xyzDataControl" RangeSize="-1"
    RefreshCondition="#{searchMASTER.queryExecuted}"/>
    to
    <iterator id="DETAILIterator" Binds="DETAILView1"
    DataControl="xyzDataControl" RangeSize="-1"
    RefreshCondition="#{adfFacesContext.postback == true}"/>
    and switching off "Generate Page Definiton" everything works as exspected!
    Peter

  • Master detail problem

    Using jsf/adf with business components.
    I have a jsp page which displays form information. This page can be used to create a new record or edit existing record. On the form, there is a section for home addresses and a different section for work addresses. I have a master detail setup. The master record is essentially an employee (view object). Also, i have one view object for Home Addresses and one view object for Work Addresses. The difference is simply in the sql where clause. One retrieves addresses where address_type LIKE 'WORK%' and the other view retrieves addresses where address_type LIKE 'HOME%. So, both views are built on the same address table. (entity object). There is a one to many (master/detail) relationship between employee and home addresses. There is also a one to many (master/detail) relationship between employee and work addresses. So, I've created view link objects for both the home address and work address and associated each to the parent record to get the master detail hooked up. things work great when i'm trying to retrieve and edit a record(s). The home addresses and work addresses are kept separate like they should be and displayed in their appropriate sections on the form. The problem i'm having is with the create record. When the page is first rendered, I want blank input fields to display for both the master record and the detail records. So, i'm programmatically creating the master and detail records before the page is rendered. I create the master row, then create one row for the work address section and one row for the home address section. The problem i'm having is that both of the detail rows which are created this way are displaying in the same work address section. So, when the page is first rendered, i see input fields only in the work address section, and both the rows have been created there, which is evidenced by the fact that i can scroll thru these two newly created records using the "next" button that was dragged/dropped for the work address section. During the create process, it appears (thru debugging) that both of these detail rows are being created properly, with their own separate iterator, so why does it appear that both rows belong to the same iterator when the page is first rendered? I have included the code below which creates the master detail rows:
    //this method is called upon the initial entry into the tabbed page if
    //user is in "create" mode. It handles creating the master and detail row(s).
    public void createMasterDetailRows(){
    ViewObject vo = getMasterView();
    Row masterRow = vo.createRow();
    masterRow.setNewRowState(Row.STATUS_INITIALIZED);
    vo.insertRow(masterRow);
    //for the initial entry into the tabbed page in create mode, the address row(s) must be created explicitly.
    createWorkAddressRow();
    createHomeAddressRow();
    public void createWorkAddressRow(){
    RowIterator iterator = (RowIterator)this.getMasterView().getCurrentRow().getAttribute("WorkAddressView");
    Row newWorkAddressRow = iterator.createRow();
    newWorkAddressRow .setNewRowState(Row.STATUS_INITIALIZED);
    iterator.insertRow(newWorkAddressRow );
    int rowCount = iterator.getRowCount();
    System.out.println("Address row inserted at " + rowCount);
    public void createHomeAddressRow(){
    RowIterator iterator = (RowIterator)this.getMasterView().getCurrentRow().getAttribute("HomeAddressView");
    Row newHomeAddressRow = iterator.createRow();
    newHomeAddressRow.setNewRowState(Row.STATUS_INITIALIZED);
    iterator.insertRow(newHomeAddressRow);
    int rowCount = iterator.getRowCount();
    System.out.println("Home Address row inserted at " + rowCount);
    }

    Sergio,
    You need to set the currency to the row passed in the request parameter from the browse page.
    You can used the row tag to do that:
    <jbo:Row id="rowCur" datasource="yourMasterDS" rowkeyparam="jboRowKey" action="find">Charles.

  • How to work with master detail?

    Dear i created sequnce for both master and detail.
    i m giving example below
    i have deptid,dept name (master table) but deptname is mandatory , in detail table i have empid,empname
    but when i click on create insert of master table and witout inserting any data in dept name(master table ) ,if click on create insert button of detail table it is showing error
    deptname is mandatory.
    but i want after inserting data in detail table when i will click on commit it should show that error.

    Seems like you are trying to insert a detail that doesn't have a master - that won't work if you are using the view object that appears under the master view.
    It should work fine if you are using the stand-alone view object.
    Read more here:
    http://docs.oracle.com/cd/E16162_01/web.1112/e16182/bcentities.htm#CEGJAFCF

  • SSIS and Update-Insert(Upsert) based on a SQL Server Result Set

    So on a weekly basis, I have to sweep a sub-set of our Member data. So my query is built to produce this result set. I then have to take that result set and compare it to a data table which contains all that same information that I have provided to a 3rd
    party vendor. So I need to take into account the following scenarios...
    Obviously, if the Member is new, then I have to Insert its row to what we'll call table 3rdPartyMember and create a row out on a 3rdPartyMemberAuditTrail Table
    Individually, I also have to manage if any of the following data fields have changed: Name, Birth Date, Addressing Information, Member Plan, Member Termination...and by Individually what I mean is that if the Last Name has changed, then update its row in
    3rdPartyMember and Insert a row to 3rdPartyMemberAuditTrail indicating "Last Name Change"...and similarly if Address Line 1 has changed..."Address Line 1 Change"
    So I guess my question is this. Should this be done in one whole Stored Procedure invoked by my SSIS Package or should it be done in pieces?
    Create the Temporary Table to house our weekly Member subset extract and result set
    Determine if the row exists on 3rdPartyMember Table and if it does not, Insert it
    If the row exists, determine if there is a First Name Change...Last Name Change...BirthDate change...Address Line 1 change...etc... If there is a change, Update 3rdPartyMember Table and also Insert a row to 3rdPartyMemberAuditTrail indicating the change
    Based on all this, I'm just not sure the right way to approach this...meaning should we create one big Stored Procedure to handle everything or each individual data point in my SSIS as an UpSert based on its lookup. I am new to the SSIS World and don't really
    know what the generally accepted practice is per se of creating and running an SSIS Package with multiple data point update steps or doing so in one big Stored Procedure.
    Also....if anyone know of some good YouTubes or web sites that would instruct me as to how to go about doing this, I'd GREATLY appreciate it.
    Thanks for your review and am hopeful for a reply.

    In my opinion using SSIS is quite a pain for Upsert-functionality, especially with your requirement of maintaining an audit trail.  With Google you can probably find 20 different variants all of which are quite complex.  I would go for the procedure
    version just to keep my sanity.  It is so easy to test and verify.
    I have been using an excellent Uppsert add on from Pragmatic Works Task Factory, but that would not help with the audit trail, though...
    http://pragmaticworks.com/Products/Features?Feature=UpsertDestination(BatchUpdateOrInsert)
    I recently discovered the CHECKSUM-function in Transact-SQL, it might simplify your code and certainly improve performance, if you have lot's of rows.
    Here is an example:
    create table member
    (id int primary key,
    name char(10) not null,
    address char(20) not null,
    checks int not null);
    create table member3p
    (id int primary key,
    name char(10) not null,
    address char(20) not null,
    checks int not null);
    create index xmember3p on member3p(id,checks);
    --create member3p_audit (...);
    insert into member values(1,'tom','new york',0);
    insert into member values(2,'mary','dallas',0);
    insert into member values(3,'marvin','durham',0);
    update member
    set checks = checksum(name,address);
    insert into member3p values(1,'tom','new york',0);
    insert into member3p values(2,'mary','chicago',0);
    update member3p
    set checks = checksum(name,address);
    insert into member3p
    select *
    from member m
    where not exists
    ( select *
    from member3p m3p
    where m3p.id = m.id );
    -- insert into audit...
    select m.*,
    case
    when m.name <> m3p1.name then 'x'
    else ' '
    end as name_change,
    case
    when m.address <> m3p1.address then 'x'
    else ' '
    end as adr_change
    from member m,
    member3p m3p1
    where m.id = m3p1.id and
    exists
    ( select *
    from member3p m3p2
    where m3p2.id = m.id and
    m3p2.checks <> m.checks );
    -- loop and update member3p and member_audit-- It's OK to update columns that were not changedupdate member3p set name = @new_name, address = @new_address;

  • Want to insert multiple rows in table using EO

    Hi,
    I have one requirement where I need to insert multiple rows at once in table lets say Previous Employers.
    What I am trying to do is I have created few textinputboxes and getting there values and putting in HashMap.
    And manually inserting the rows to EO. I am not getting any error but the data is not populating in Table.
    here is the code snap ...please suggest!!
    public void updateKoelHrPreEmpVO(HashMap map)
    OADBTransaction txn = getOADBTransaction();
    //HashMap map = new HashMap();
    KoelHrPreEmpVOImpl empVO = getKoelHrPreEmpVO1();
    KoelHrPreEmpVORowImpl fetchedRow = null;
    int fetchedRowCount = empVO.getFetchedRowCount();
    RowSetIterator deleteIter = empVO.createRowSetIterator("deleteIter");
    if (fetchedRowCount > 0)
    if(txn.isLoggingEnabled(2))
    txn.writeDiagnostics(this,"Removing rows from KoelHrPreEmpVO :: Current count :: " + fetchedRowCount ,2);
    //System.out.println("Removing rows from KoelHrPreEmpVO :: Current count :: " +fetchedRowCount);
    deleteIter.setRangeStart(0);
    deleteIter.setRangeSize(fetchedRowCount-1);
    for (int i = 0; i < fetchedRowCount; i++)
    //System.out.println("Removing Row :: "+i);
    if(txn.isLoggingEnabled(2))
    txn.writeDiagnostics(this,"Removing row :: " + i ,2);
    fetchedRow = (KoelHrPreEmpVORowImpl)deleteIter.getRowAtRangeIndex(i);
    fetchedRow.remove();
    getTransaction().commit();
    deleteIter.closeRowSetIterator();
    if(empVO.getRowCount() == 0) {
    Row row = null;
    KoelHrPreEmpVORowImpl insertRow = null;
    empVO.first();
    if(txn.isLoggingEnabled(2))
    txn.writeDiagnostics(this,"Inserting rows to KoelHrPreEmpVO :: " ,2);
    try
    for(int i=1; i<=4; i++) {
    insertRow = (KoelHrPreEmpVORowImpl)empVO.createRow();
    insertRow.setEmployeeNumber(map.get("EmployeeNumber").toString());
    insertRow.setPersonId(new Number(map.get("PersonId").toString()));
    insertRow.setEmployer(map.get("Employer"+i+"").toString());
    insertRow.setStartDate(Date.toDate(map.get("StartDate"+i+"").toString()));
    insertRow.setEndDate(Date.toDate(map.get("EndDate"+i+"").toString()));
    insertRow.setEmployer(map.get("Designation"+i+"").toString());
    empVO.insertRow(insertRow);
    insertRow.setNewRowState(Row.STATUS_INITIALIZED);
    getTransaction().commit();
    catch(SQLException ex)
    ex.printStackTrace();
    Regards,
    Mukesh

    1. Pls check if the create() methos in EOImpl is in place, setting the primary key.
    2. Even though we insert values in this fashion , it only gets inserted if user performs any action, like manipulates some column. Pls check if there is any mechansm to make the row dirty ( as if done by user).
    Srikanth

  • Project server 2013 master project and site with subprojects and subsites

    i have a master project and try to create a sub site off the master project site. when I use project pro and publish  and check "Provision the site as a subsite of another project I get an error. I have notice that the target URL changes. so unchecked
    I get http://sharepoint/pwa/project1. so when I check it the target url becomes
    http://sharepoint/masterproject/project1 where masterproject is the master. any ideas what I can do to have my sub project be a sub site of my master project. my master is a
    http://sharepoint/pwa/masterproject. so my subproject should be http://sharepoint/pwa/masterproject/project1

    So what i am getting from your question is
    1. Problem you are getting error while trying to provision a site as subsite of another project, to resolve this we need to know what is the error you are getting ?
    Also when you say URL Changes, what does that means?
    2.  For having your sub projects as part of master project, you should first publish your Master project which would create a project workspace for Master Project and then insert your sub projects within the master project(Or individually) and start
    publishing your Sub projects and select provision this site as part of Subsite and in there  select your master program name
    Now when you goto the master project site and do view all site content, it should show you both other sub project sites underneathh it
    Thanks | epmXperts | http://epmxperts.wordpress.com

  • Insert master and detail rows with Composition assoc generating JBO-26048

    I have the Master and Detail Entity Objects and made an Association linking them as Composition related.
    I have 2 ViewObjects. the MasterViewObject is composed of the Master entity object and 1 other udpateable object. the DetailViewObejct only contains the Detail entity Object.
    I tried to create a row on the masterviewobject and then immeidately create a detail row, and then commit, ADF issues a JBO-26048 error. Constraint "MY_FK" violated during post operation.... ".
    I don't know wahts wrong, but this should not be error should nit be appearing, as ViewObjects and the Links with Composition Association take care of populating the Foreign Keys of the detail. Or am I missing something here?

    The ADF Guide covers this problem, and I have a method that works as well on jdevguru.com. Take a look at the manual first, they have an indepth view on it and how to get it all to work together.
    Kelly

  • Creating a new row in a master detail VO relation and its consequences.

    Hi,
    I'm currently facing a lot of problems which make me doubt if my perception about the whole ADF entity-view object mechanism is right.
    I have a page which displays data from a master detail VO relation (master offer - detail officeinfo). I also have a small dialog LOV window which makes it possible for me to select an office to match up with the current offer... Both the office LOV and the officeInfo detail use the same Office entity object.
    This worked perfectly fine until I wanted to add create NEW offers. I created my own insert method which basically performs a createRow on the master VO and inserts the newly created row in this VO. On a sidenote, I also fill out some default data read from a property file, which is why I decided to implement my own insert method in the first place.
    Initially, the problem was that the inputText fields of the detail VO (OfficeInfo) were not displayed at all. I imagined that I also had to perform the create and insert methods on the detail VO and indeed, from that point on all inputText fields were displayed and my page was ready for input.
    Yet today, I notice that in my Office LOV which is based on the same entity as the one my detail OfficeInfo VO uses, this newly created row is ALSO visible. To me this is quite unwanted and surprising behavior. I did not expect the row already to be visible in the LOV, since basically it's just an empty row ready for input...
    Am I perceiving things wrong? Or anyone has a nice solution to fix this?
    Thanks,
    Douglas

    Hi Douglas,
    It is happening because you have created an updateable office LOV which is based on same entity object used to save your newly created records.
    Use readonly LOV based on plsql query in your page and you can keep rest of the thing as it is.
    I think it will solve your problem.
    Cheers,
    Suyog

  • Insert a row in master detail view & jboRowKey parameter

    Hi
    I hava a minor problem.
    On JSP page I have edit form for master view, beyond edit form is browse of detail view. I would like to insert or edit a row on master view and after update and commit, a would like to stay on the same page to insert some rows into detail view.
    When I editing rows it is Ok, becose jboRowKey parameter is always the same (to find proper row on master view).
    Problem appears when I want to Insert a row into master view, becose after transaction is commited, jboRowKey parameter is changed.
    Primary key on master table is sequence and it is inserted by (preinsert) trigger before commit.
    If anybody has some idea to solve this problem, please help.
    Gorazd

    Without knowing exactly the technology you are using, (JDev version, BC4J JSP tags/Components tags?),
    In general with BC4J after you do a commit, you do not necessarily have a record pointer on the new record that you just insert on the master table, so you would have to locate it again.
    Here is one way you could do this.
    After you commit your new inserted record, you could go back to a master "browse" page which shows the records of your master table along with a link to it's corresponding detail page. Encoded in the link you could pass the rowkey of the master record as a parameter and then in the detail page you could locate the master record that was clicked on by using the Find operation of the Row tag. When the master row is located, you automatically would be pointing to the correct detail records.
    In this case since the master was just created, there wouldn't be any detail records yet. You could then create new detail records for the new master..
    Let me know if this helps..
    -Chris

  • Inserting rows in master-detail views

    I have two VOs connected by a view link. I want to insert new rows in both the master VO and the detail VO and connect them together.
    I have the following:
    MasterEO (mapped to master_table)
    MasterVO (defined on MasterEO)
    DetailEO (mapped to detail_table)
    DetailVO (defined on DetailEO)
    MasterDetailAO (1 to many Association between MasterEO and DetailEO. master_id in detail_table references id in master_table)
    MasterDetailVL (1 to many ViewLink defined on MasterDetailAO)
    My AM looks like:
    MasterVO
    DetailVO via MasterDetailVL1
    I am trying to insert a new row in MasterVO, and a new row in DetailVO that should be linked to the new row in MasterVO. I used the code listed below. I was able to get the DetailEOImpl from the new row in DetailVO, and then get the new MasterEOImpl from the DetailEOImpl. However, when I called drow.getMasterVO() (drow being the new row created in DetailVO), I got null back instead of the new row in MasterVO. What do I have to do to connect the new row in MasterVO and DetailVO? (I got the same results regardless of whether the association is a composition or not)
    Also another thing I noticed, even though I've called setMaxFetchSize(0) on both VOs, the sql trace still shows the queries being executed. Is there anything else I need to do?
    MasterVOImpl master = (MasterVOImpl) testAM.findViewObject("MasterVO");
    DetailVOImpl detail = (DetailVOImpl) testAM.findViewObject("DetailVO");
    master.setMaxFetchSize(0);
    detail.setMaxFetchSize(0);
    MasterVORowImpl mrow = (MasterVORowImpl) master.createRow();
    mrow.setId(new oracle.jbo.domain.Number(10));
    master.insertRow(mrow);
    DetailVORowImpl drow = (DetailVORowImpl) detail.createRow();
    drow.setDetailId(new oracle.jbo.domain.Number(100));
    detail.insertRow(drow);
    DetailEOImpl deoi = drow.getDetailEO();
    MasterEOImpl meoi = deoi.getMasterEO();
    if (meoi != null)
    System.out.println("ID from EO: " + meoi.getId()); // This value is correct
    Row mrw = drow.getMasterVO(); // RETURNS NULL INSTEAD OF THE NEW ROW
    if (mrw != null)
    System.out.println("Row Class from Detail VO: " +
    mrw.getClass().getName());
    else
    System.out.println("Master VO is null");
    // THE OTHER DIRECTION ALSO DOESN'T WORK
    RowIterator rt = mrow.getDetailVO();
    DetailVORowImpl dd = (DetailVORowImpl) rt.first();
    // dd IS NULL
    if (dd != null)
    System.out.println("New Detail Row: " + dd.getDetailId());
    else
    System.out.println("New Detail Row from Master is null");

    You need to make your ViewObjects 'AssociationConsistent' for all collections to see new rows inserted into the cache. To set this setting for all VOs, edit your Appliation Module configuration and set the value for jbo.viewlink.consistent to be true.

  • Programmatically Inserting Row in a 1-1 Master Detail

    JDeveloper 11.1.1.2.0
    In a 1-1 relationship, your accessor will be returning a ROW instead of a ROWITERATOR/ROWSET.
    This means that you first need to create a row to even set the row rather than getting the rowset and inserting directly. I'm looking for the best way to insert a row in both the master and detail programmatically.
    So far what i've done so far are:
    1. Inside VO i have a method that i expose that creates master row then creates detail row using their entity definition:
    <masterName>EntityImpl masterRow = <masterName>EntityImpl.getDefinitionObject().createInstance2(this.getDBTransaction(), null);
    <detailName>EntityImpl detailRow = <detailName>EntityImpl.getDefinitionObject().createInstance2(this.getDBTransaction(), null);
    detailRow.setAttribute("masterId",masterRow.getAttribute("masterId));
    2. Create in ApplicationModule by getting VO's and utilizing create and insert VO methods.
    I'm wondering if there is a different approach in doing this. Take note that this is a 1-1 relationship.

    Drag the Create operation for your VO to the page as the first button.
    Then use the same VO in the pop-up as a form where people insert the data.
    http://andrejusb.blogspot.com/2010/05/crud-operations-in-oracle-adf-11g-table.html

Maybe you are looking for

  • Trouble Connecting to Router, OS 9.0.3

    Hey guys, I'm on my ibook G4 as of now, and I have a wireless network set up through my d-Link router. I'm on verizon dsl, and I just pulled out my old iMac(whatever kind it is, may be the bondai blue model I'm not sure) It's running OS 9.0.3 with a

  • Crop Marks on the image

    Hi All I am producing some exhibition panels and our printer would like the crop marks actually on the image. When I export to PDF the crop marks appear in a white area around the image - is there any way I can remove that white area and show the cro

  • Images not displaying on the web

    I've written an applet that displays jpg and gif images. It works fine in Kawa, but when I run the applet on the web, I run into the following problem: The applet runs fine, with full functionality, except that the images are not displayed. I know th

  • Aren't there supposed to be more presets in the Color FX room in ver 1.5?

    Maybe I am crazy, but I thought there were more preset looks in FCS3?

  • Help needed to STOP xml loading

    Hi there, I'm pretty new to the action script side of things, have had some help on here already and have also been pulled up for asking for too much help. Well I'm kind of getting the hang of it now, but am having one major problem with the site I'm