Programmatic row insertion into view object then db

Hi,
I am committing a table into a database with this code in a managed bean. I have a requirement that I have to update a row in the database after a web service call. Is the code that I am writing here fine to be in a managed bean? Should I instead create a method in the Appmodule somehow to do this or in the ViewObjectImpl? Any advice would be appreciated.
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
DCBindingContainer bc = (DCBindingContainer) bindings;
ApplicationModule am = bc.getDataControl().getApplicationModule();
ViewObject myView = am.findViewObject("UsersView");
Row newRow = (oracle.jbo.server.ViewRowImpl)myView.createRow();
newRow.setAttribute("User", userName);
newRow.setAttribute("BirthDate", date);
newRow.setAttribute("SpecialAttribute", false);
myView.insertRow(newRow);
operationBinding = bindings.getOperationBinding("Commit");
result = operationBinding.execute();
web service call
//update the last row in the table that we just inserted
Row updatedRow = myView.removeCurrentRowAndRetain();
newRow.setAttribute("SpecialAttribute", true);
operationBinding = bindings.getOperationBinding("Commit");
result = operationBinding.execute();

I have moved this to the application module but get this error when I try to invoke it from the MB.
oracle.jbo.InvalidOperException: JBO-25221: Method XXXXAppModuleDataControl.dataProvider.processAction) not supported
My code is:
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("processAction");
operationBinding.getParamsMap().put("xx", xx);
operationBinding.getParamsMap().put("yy", yy);
operationBinding.execute();
am I doing anything flagrantly wrong here? processAction takes in two parameters and I have bound to the page definition file.

Similar Messages

  • Get JBO-27023 exception when programmatically inserting in view object

    I am using Jdev 11 R2 (11.1.2.3.0) JSF2 & Facelet
    In some use case I require to read information from some external source (a web service in this case)
    and Programmatically insert into Oracle DB
    I use below code to get view object from application module
    //from ADFUtils
         public static ApplicationModule getApplicationModuleForDataControl(String name) {
    return (ApplicationModule)JSFUtils.resolveExpression("#{data." + name + ".dataProvider}");
         public static ViewObject getViewObject(String appModCtrlNam, String viewObjCtrlNam) {
    ApplicationModule am = getApplicationModuleForDataControl(appModCtrlNam);
    return am.findViewObject(viewObjCtrlNam);
         ViewObjectImpl testVW =
    (ViewObjectImpl)ADFUtils.getViewObject("AppModuleDataControl", "View1");
    Row testRow = testVW.createRow();
         testRow.setAttribute("property1",value1);
         testRow.setAttribute("property2",value1);
         testRow.setAttribute("property3",value1);
         testRow.setAttribute("property4",value1);
         testVW.insertRow(testRow);
         and finally commit bounded task flow
         TaskFlowUtils taskFlowUtils = new TaskFlowUtils();
    taskFlowUtils.commitTaskFlow();
         public void commitTaskFlow() {
    getDataControlFrame().commit();
    public DataControlFrame getDataControlFrame() {
    BindingContext bindingContext = oracle.adf.controller.binding.BindingUtils.getBindingContext();
    String dataControlFrameName = bindingContext.getCurrentDataControlFrame();
    DataControlFrame dataControlFrame = bindingContext.findDataControlFrame(dataControlFrameName);
    return dataControlFrame;
         There are some inner objects so I need to repeat this logic for some other view objects (don't put it here to make post shorter)
         Every thing is OK but when number of record I read from that external source increased I will receive
         JBO-27023: Failed to validate all rows in a transaction.
         And system can not commit transaction
         What I mean about the increase in number of records is totaly 50 records not 10000 records
         I mean if I run my method with 3-5 records it is working fine , if I run it with 50 records I will receive JBO-27023
         I am using a method in application module to get sequence from DB and transaction in bounded task flow defined as "Always Begin New Transaction"
         Any idea where is wrong or what is work around?
         Thanks
         Mohsen

    Hi Frank
    I saw that blog from Jobinesh as he mentioned
    public String someAction() {
    BindingContainer bindings = getBindings();
    OperationBinding ob = bindings.getOperationBinding("doSomething");
    Object result = ob.execute();
    if (!ob.getErrors().isEmpty()) {
    return "error";
    return "success";
    But in my use case I need to insert into view objects programmatically not executing a method in app module
    What is they best way of doing this?Should I put this inserts as method in app module?
    and where I can find new version of ADFUtils?
    Appreciate your comments
    Regards
    Mohsen

  • Programatically inserting rows of a view object trouble

    Hi,
    I'm using JDev 10.1.3.3. I'm trying to use the application module specific to my app to create rows in a viewobject. User is on page "view", goes to page "new" and fills out a form which upon submit sends the data to an Application Module method I've exposed to the client. What doesn't happen, is when I add the row of the view object programatically in my view object, it doesn't display on the "view" page until a commit is done (when navigating back from the "new" page".
    Here is some sample code of the insert into a composite (not composition) viewobject. When I insert in the new page, it returns to the view page... and the row doesn't show up until commit happens:
    //in my application module
    public void doiIt2(String name, String badge, String item){
    UserItemViewObjRowImpl row = null;
    row = (UserItemViewObjRowImpl)getUserItemViewObj1().createRow();
    row.setBadge(badge);
    row.setBadge1(badge);
    row.setItem(item);
    row.setName(name);
    row.setNewRowState(Row.STATUS_NEW);
    getUserItemViewObj1().insertRow(row);
    getUserItemViewObj1().executeQuery();
    Does anybody know how to get this row to pop in, like using a "creation form" to a table in a view page? What am i doing wrong??? Do I need to do something special in my pagedef of the "view" page?
    Thanks,
    Dan

    Chris,
    Thank you for looking at my problem. The row is not inserted into the table (on the view page) with the code I shared. The criteria for the table's VO is simply a select all, with no where clause, so I don't think I'm excluding it... Upon hitting a commit button, the new row does pop in to the table witch is further evidence that the criteria for the VO isn't excluding the new row.
    I have tried insertRowAtIndex(), even before I posted this with no luck.
    BTW, if I add to the bottom of the code I shared, getDBTransaction().commit; or getDBTransaction().postChanges(), the row does pop into the table when the "view" page is navigated to.
    Am I doing something wrong with my construction of my ViewObject? It is a composition (I got that wrong in my initial post) between two entities. The Item entity is updateable, and not a reference using an association between the two entities on the Badge attribute.
    I am trying to have new composite VO rows always show up as the first item in a table. I've read that the Row.STATUS_NEW will always do this... so I'm trying to avoid posting/committing the new row. I'm also not above inserting at a particular location, but some of the pages I hope to use this pattern with re-execute the VO every time the page is rendered, instead of just rebinding the Iterator with the VO rowsets. I'm being led to believe that if a Row is posted or committed, re-executing the query will resort all rows based on 'order by', etc.
    Also, I have setup a similar yet even more complicated example using three entities. I was able to make this work as expected. The difference is that I was using an ADF Creation Form. ( I did have some work in the model to make all the keys line up though.... posting order... etc.).
    I have gotten similar things like this to work with single entities VOs. I'm just having trouble when I do composite VOs. That is supported, isn't it?
    Dan

  • How to Insert the row in the View object

    I want to insert the row in the view object by instantiating Impl.java file
    Could someone please let me know how to insert the blank row
    Thanks

    Inserting onto a view object should be done the following way:
    //vo is your view object
    Row aRow = vo.createRow();
    //Set your attributes
    aRow.setAttribute("AttributeName", objectValue);
    //insert
    vo.insertRow(aRow);
    That should work for you if you are programming the input. If you are using java components bound to columns in a view object then the input should be done automatically for you when you commit.

  • Way to rollback only one row of a view object

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?
    Thanks

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.In jdev903, a new method is being added to Row interface to reset the row state to the transaction-original state i.e., rollback the row to it's original values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?No. You may however override before/afterRollback methods on the ViewObjectImpl subclasses to cache the current row key in beforeRollback and restore currency on the default iterator to that rowkey in afterRollback
    Thanks

  • How to populate data into view object

    Hi all,
    I am quite new with ViewObject.
    I have one data table which is binding with view object.
    I want to populate data into view object from my managed bean.
    how can i achieve this kind of scenario?
    actually i try to get view object as in the following. but i get only null.
    ViewObject viewobject = DCIteratorBinding.getViewObject();
    With Regards,
    Wai Phyo

    Hi,
    You could use the following code snippet to get handle to view object from the iterator.
    FacesContext fc = FacesContext.getCurrentInstance();
    BindingContainer bindings =
    (BindingContainer)fc.getApplication().evaluateExpressionGet(fc,
    "#{bindings}",
    BindingContainer.class);
    DCBindingContainer bc = (DCBindingContainer)bindings;
    DCIteratorBinding iterator =
    bc.findIteratorBinding("<ITERATOR_ID>");
    ViewObject viewObject = iterator.getViewObject();
         // Perform operations on the view objectThanks,
    Navaneeth

  • Insert into views

    Hi,
    Using instead of triggers how can i insert into views. give me example of that. its very helpful to me
    thanks in advance

    Hi,
    Refer
    http://www.databasejournal.com/features/mssql/article.php/1437741
    Might be useful.
    Cheers
    Nirmal
    [pre[                                                                                                                                                                                                                                                                                                   

  • URGENT: Insert multiple rows in a view object cache from the same Page

    Please let me know whether I can get insert multiple rows in the same view object from a single page.
    I'm using UIX on Jdeveloper 9.0.5.2
    Thanks a lot.

    Hi,
    please check Duncan Mills how-to on this
    http://www.oracle.com/technology/products/jdev/tips/mills/JSP_Multi_Row_Edits.html
    Frank

  • BULK INSERT into View w/ Instead Of Trigger - DML ERROR LOGGING Issue

    Oracle 10.2.0.4
    I cannot figure out why I cannot get bulk insert errors to aggregate and allow the insert to continue when bulk inserting into a view with an Instead of Trigger. Whether I use LOG ERRORS clause or I use SQL%BULK_EXCEPTIONS, the insert works until it hits the first exception and then exits.
    Here's what I'm doing:
    1. I'm bulk inserting into a view with an Instead of Trigger on it that performs the actual updating on the underlying table. This table is a child table with a foreign key constraint to a reference table containing the primary key. In the Instead of Trigger, it attempts to insert a record into the child table and I get the following exception: +5:37:55 ORA-02291: integrity constraint (FK_TEST_TABLE) violated - parent key not found+, which is expected, but the error should be logged in the table and the rest of the inserts should complete. Instead the bulk insert exits.
    2. If I change this to bulk insert into the underlying table directly, it works, all errors get put into the error logging table and the insert completes all non-exception records.
    Here's the "test" procedure I created to test my scenario:
    View: V_TEST_TABLE
    Underlying Table: TEST_TABLE
    PROCEDURE BulkTest
    IS
    TYPE remDataType IS TABLE of v_TEST_TABLE%ROWTYPE INDEX BY BINARY_INTEGER;
    varRemData remDataType;
    begin
    select /*+ DRIVING_SITE(r)*/ *
    BULK COLLECT INTO varRemData
    from TEST_TABLE@REMOTE_LINK
    where effectiveday < to_date('06/16/2012 04','mm/dd/yyyy hh24')
    and terminationday > to_date('06/14/2012 04','mm/dd/yyyy hh24');
    BEGIN
    FORALL idx IN varRemData.FIRST .. varRemData.LAST
    INSERT INTO v_TEST_TABLE VALUES varRemData(idx) LOG ERRORS INTO dbcompare.ERR$_TEST_TABLE ('INSERT') REJECT LIMIT UNLIMITED;
    EXCEPTION WHEN others THEN
    DBMS_OUTPUT.put_line('ErrorCode: '||SQLCODE);
    END;
    COMMIT;
    end;
    I've reviewed Oracle's documentation on both DML logging tools and neither has any restrictions (at least that I can see) that would prevent this from working correctly.
    Any help would be appreciated....
    Thanks,
    Steve

    Thanks, obviously this is my first post, I'm desperate to figure out why this won't work....
    This code I sent is only a test proc to try and troubleshoot the issue, the others with the debug statement is only to capture the insert failing and not aggregating the errors, that won't be in the real proc.....
    Thanks,
    Steve

  • Need help on how to specify the current select row in a View Object

    Hi,
    I have a ADF table on my page, when I was selecting the rows in this table, I want the set and get methods in the ViewRowImpl class to do some customized actions. I found out that each time regardless the row I select in the table, the viewrowimpl class will always return the data in the first row, I tried to use getCurrentRow in VO row impl. but still, gets the first row.
    Does anyone know how to get the selected row value in the View Object, or View Row Impl rather???
    Thanks!

    Hi,
    you can call a method exposed by the AM and pass teh rowKey of the selected row as an argument. When you configure the exposed AM method in the pageDef (creating a method binding) the argument is shown in a dialog from where you can use EL like #{bindings.iteratorName.currentRow.rowKey} to access the current selected row.
    Frank

  • Inconsistent datatypes error when inserting into a object

    I am trying to insert some test data into the table emp.I have managed to succesfully create the objects and types but when I try to insert into the emp table I get a inconsistent datatypes error however I have checked the datatypes and they all seem fine. Can anyone help me.
    thanks
    CREATE OR REPLACE TYPE Address_T AS object
    (ADDR1                VC2_40,
    ADDR2               VC2_40,
    CITY_TX          VC2_40,
    COUNTY_CD          VC2_40,
    POST_CD          VC2_40);
    CREATE OR REPLACE TYPE PERSON_T AS OBJECT (
    LNAME_TX           NAME_T,
    FNAME_TX           NAME_T,
    BIRTH_DATE          DATE,
    TELEPHONE          VC2_20,
    EMAIL               VC2_40);
    CREATE OR REPLACE TYPE EMP_T AS OBJECT (
    EMP_ID     NUMBER (10),
    PERSON     PERSON_T,
    ADDRESS ADDRESS_T,
    HIRE_DATE DATE)
    CREATE TABLE EMP OF EMP_T
    (EMP_ID NOT NULL PRIMARY KEY);
    INSERT INTO EMP VALUES (1,           
    PERSON_T('PETCH',
    'GAVIN',
    '23-JAN-80',
    '(01964)550700',
    '[email protected]'),
    ADDRESS_T('67 CANADA',
    'WALKINGTON',
    'BEVERLEY',
    'EAST YORKSHIRE',
    'HU17 7RL'),
    '11-FEB-02'
    ERROR at line 1:
    ORA-00932: inconsistent datatypes

    Gavin,
    What is your VC2_40 and NAME_T type definition? Your insert used these as varchar2, which is a built-in type not a user-defined type. If you explicitly define these to be varchar2's, the insert statement works fine.
    Regards,
    Geoff
    I am trying to insert some test data into the table emp.I have managed to succesfully create the objects and types but when I try to insert into the emp table I get a inconsistent datatypes error however I have checked the datatypes and they all seem fine. Can anyone help me.
    thanks
    CREATE OR REPLACE TYPE Address_T AS object
    (ADDR1                VC2_40,
    ADDR2               VC2_40,
    CITY_TX          VC2_40,
    COUNTY_CD          VC2_40,
    POST_CD          VC2_40);
    CREATE OR REPLACE TYPE PERSON_T AS OBJECT (
    LNAME_TX           NAME_T,
    FNAME_TX           NAME_T,
    BIRTH_DATE          DATE,
    TELEPHONE          VC2_20,
    EMAIL               VC2_40);
    CREATE OR REPLACE TYPE EMP_T AS OBJECT (
    EMP_ID     NUMBER (10),
    PERSON     PERSON_T,
    ADDRESS ADDRESS_T,
    HIRE_DATE DATE)
    CREATE TABLE EMP OF EMP_T
    (EMP_ID NOT NULL PRIMARY KEY);
    INSERT INTO EMP VALUES (1,           
    PERSON_T('PETCH',
    'GAVIN',
    '23-JAN-80',
    '(01964)550700',
    '[email protected]'),
    ADDRESS_T('67 CANADA',
    'WALKINGTON',
    'BEVERLEY',
    'EAST YORKSHIRE',
    'HU17 7RL'),
    '11-FEB-02'
    ERROR at line 1:
    ORA-00932: inconsistent datatypes

  • How to add row in multiple view object based on common entity object.

    Hi ,
    I have
    Jdeveloper version - 10.1.3.3.0
    Oracle Database - 11g R2
    I have a situation where i have to show data from one table in three adf tables on jsf page depending on a flag value in a column in table. For this purpose i have done the following steps
    a) Created an entity object on the database table .
    b) Created three view objects on this entity object and edited the view object's SQL and included the where clause
                       WHERE  A.USER_PERSONAL_NO = :P_USER_PERSONAL_NO AND
                           A.AUTH_TYPE = 'LF'
                       The auth_type cloumn decided in which view object the data will be shown
    Now, when i query the data from database by executing the query of these view objects the data is shown correctly in all three view objects. Till here there seems every thing ok
    Now , i have to provide the logic to add records in the adf tables for this i have provided add button in action facet of all three tables which are binded to methods in managed bean,
    when i add a record in a adf table by add button the new row which is created is shown in all three tables . I cant understand why this is happening , please help me to solve this problem.
    How can i make it possible so that the record appears only in that adf table in which the record is added.
    The method for adding record is
                Row rw = currentAM.getWfRecommAuths().createRow();
                rw.setAttribute("UserPersonalNo",this.getQuery_personal_no().getValue());
                rw.setAttribute("AuthPersonalNo","");
                rw.setAttribute("AuthType","LX");
                currentAM.getWfRecommAuths().last();
                currentAM.getWfRecommAuths().insertRow(rw);
               Please help , thanks in advance.

    Hi,
    have a look at polymorphic view objects
    http://download.oracle.com/docs/cd/E21764_01/web.1111/b31974/bcadvvo.htm#CEGDCCCB
    Frank

  • Inserting into views

    Hi everybody.
    I have a question regarding inserting data through views.
    One can insert and delete rows through a view only if the view definition doesn't have the following:1. Distint clause
    2. Group By clause
    3. Start With clause
    4. Connect By clause
    5. ROWNUM clause
    6. Subquery in the select clause
    7. Set operators
    Can you please tell me why is this restriction placed?

    For the same reason we can't do DML with views that are joins of more than one table: a row in the view does not, cannot map to a single row in the underlying table (or, in the case of ROWNUM, to a column in that table).
    If you have a need to do this sort of thing you need to investigate INSTEAD OF triggers. But approach with caution.
    Cheers, APC

  • How to execute a Java method when row inserted into a database table?

    I have the need to fire off a java method when a row is inserted into a database table. I am unfortunately working with MySQL which just recently supported triggers but these new triggers can not execute a Java application on any event.
    What I am looking for is an event driven approach such that when a row is inserted into a specific table I can fire off a java method (sitting in a tomcat container) that will take the contents and send it to a web service.
    It has been mentioned that JMS may have the ability to poll and monitor a database table. Just wondering if anyone could point me in the right direction.
    thanks
    JavaTek

    A service handler might be the right way to run some code at the end of a service call (another way would be to make use of filters).
    First, make sure your static table is merged with ServiceHandlers.
    Secondary, change your custom method name into one that is not already in the service definition of COLLECTION_COPY_LOT (preferably a unique method name like collectionCopyLotLastAction that describes its purpose) and remove the following line from your code:
    m_service.doCodeEx("",this);Now create a service definition for COLLECTION_COPY_LOT in your custom component based on the original COLLECTION_COPY_LOT (copy paste from the original service definition) and add you own method collectionCopyLotLastAction as the last step in the service. Play with the load order to make sure CS is using your service definition of COLLECTION_COPY_LOT instead of the original.
    regards,
    Fabian

  • No rows inserted into cube REL_EXPENSE

    Dear all,
    This week I've spent some hours walking through the online training for Oracle Warehouse Builder 10g on Oracle Technet which can be found here:
    http://www.oracle.com/technology/obe/admin/owb10gr2_gs.htm
    Everything went fine until I had to load data into cube REL_EXPENSE. Somehow the mapping that I created (REL_EXPENSE_MAP) does not insert any rows into table REL_EXPENSE.
    The lesson I'm referring to which builds the mapping for the cube is:
    http://www.oracle.com/technology/obe/10gr2_owb/owb10gr2_gs/owb/lesson4/etl-mappings.htm
    Additional information:
    -- The target table (REL_EXPENSE) that is needed for loading the data is created successfully.
    -- The external table which i created during an earlier lesson was created without any problems. If I SELECT the table (EXPENSE_DATE) I see the records from the CSV file in the table.
    -- I've tried to debug the mapping and I could see the rows go through the External Table Operator and through the Expression operator (which converts dates to numbers). The records won't get inserted into the target table by the Cube Operator though.
    Since I'm new to OWB I am not able to solve this problem on my own, so I hope you guys can give me a hint where to look so I can solve the problem.
    Thanks in advance!
    Kind regards,
    Theo

    Insert into ....
    INSERT
       INTO "IIA_DATA"."FAITS_EX_POST"@"DIIAV3@EMP_IIA_DATA"
        "NOMBRE"             ,
        "DIM_EX_POST"        ,
        "DIM_SERVICE_EX_POST",
        "DIM_TEMPS_EX_POST"
      (SELECT to_number( "V_FAITS"."R_VALEUR" ) "NOMBRE"                                       ,
          "DIM_EX_POST"."DIMENSION_KEY" "DIMENSION_KEY"  ,
          "DIM_SERVICE"."DIMENSION_KEY" "DIMENSION_KEY_2",
          "DIM_TEMPS"."DIMENSION_KEY" "DIMENSION_KEY_1"
           FROM "V_FAITS" "V_FAITS"                                   ,
          "V_DIMENSIONS_FAITS" "V_DIMENSIONS_FAITS"                   ,
          "IIA_DATA"."DIM_TEMPS"@"DIIAV3@EMP_IIA_DATA" "DIM_TEMPS"    ,
          "IIA_DATA"."DIM_SERVICE"@"DIIAV3@EMP_IIA_DATA" "DIM_SERVICE",
          "IIA_DATA"."DIM_EX_POST"@"DIIAV3@EMP_IIA_DATA" "DIM_EX_POST"
          WHERE ( "V_FAITS"."I_ID" BETWEEN 1 AND 142 )
        AND ( "V_FAITS"."R_ID"              = "V_DIMENSIONS_FAITS"."R_ID" )
        AND ( "V_FAITS"."MONTH_CAL_CODE_ID" = "DIM_TEMPS"."CALENDAR_MONTH_CAL_MONTH_CODE" )
        AND ( "V_FAITS"."R_VALEUR_AXE"      = "DIM_SERVICE"."SERVICE_ACS" )
        AND ( (to_number("DIM_EX_POST"."COMPTABILISATION_ID_FONC" )) = "V_DIMENSIONS_FAITS"."NE_ID" )
      )Output :
    0 rows inserted

Maybe you are looking for