EJB 3.0 - Custom create method - current row in adf table

Hello,
its funny I cannot find a good solution for such simple problem.
I'm using EJB 3.0 stateles session bean, ADF controller and ADF Faces.
I have simple page with read-only adf table containing roles and Create Role button. The button sends you to create page. This works.
I wrote my own create role method in session bean.
When I use this method instead of standard create then the new role row is no longer current in adf table. So create page displays different row not the new one.
How to make my new role row current in the adf table?
Rado

Thank you Frank,
yes this seems to be the only solution I can use.
In fact the role table is detail table. This is why I have my own constructor with one parameter: master entity. So the "create page" you suggested have to have access to master entity and this is why I wanted to create new role instance on fist page - there is master entity accessible.
Now I need to send master instance to create_page somehow.
What you think is the best way? Are bindings from previous page accessible directly or I have to use request/session/process scope?
Another solution would be to have method "createAnotherDetail" in master entity. But I'm afraid I will have again problem with currency.
Rado

Similar Messages

  • How to create multiple new rows in ADF Table?

    Hello,
    being new to ADF Faces/BC I managed to display data in an ADF Table and create new entries using the "CreateInsert" operation (one at a time).
    Now, the next task is to create multiple new rows at the same time, set some default values and display the new rows in the ADF table. Then the user will enter additional data and commit the new rows.
    Where do I step in? In the EntitiyImpl? Can this be handled declaratively or do I have to implement custom method(s) in the AM?
    Thanks
    Gerald

    Hi John,
    I'm still getting the following error
    Error(94,144): method getValue() not found in class javax.faces.el.ValueBinding
    What should it be casted to?
    The code in backing bean is like this..
    package view.backing;
    //import com.test.model.TestAppModuleImpl;
    import javax.faces.component.html.HtmlForm;
    import javax.faces.component.html.HtmlPanelGroup;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    //import javax.faces.event.FacesListener;
    //import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.adf.view.faces.component.core.data.CoreColumn;
    import oracle.adf.view.faces.component.core.data.CoreTable;
    import oracle.adf.view.faces.component.core.input.CoreInputText;
    import oracle.adf.view.faces.component.core.nav.CoreCommandButton;
    import oracle.adf.view.faces.component.core.output.CoreMessages;
    import oracle.adf.view.faces.component.html.HtmlBody;
    import oracle.adf.view.faces.component.html.HtmlHead;
    import oracle.adf.view.faces.component.html.HtmlHtml;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.Row;
    import oracle.jbo.ViewObject;
    //import oracle.jbo.server.ViewObjectImpl;
    //import view.utils.EL;
    public class MultipleInsert1 {
    private HtmlHtml html1;
    private HtmlHead head1;
    private HtmlBody body1;
    private CoreMessages messages1;
    private HtmlForm form1;
    private CoreTable table1;
    private CoreColumn column1;
    private CoreInputText inputText1;
    private CoreColumn column2;
    private CoreInputText inputText2;
    private CoreCommandButton commandButton1;
    private HtmlPanelGroup panelGroup1;
    private CoreCommandButton commandButton2;
    public void setHtml1(HtmlHtml html1) {
    this.html1 = html1;
    public void createMultiRows(ActionEvent actionEvent) {
    DCBindingContainer dc = (DCBindingContainer) FacesContext.getCurrentInstance().getApplication().createValueBinding("#{bindings}").getValue();
    DCIteratorBinding iter = dc.findIteratorBinding("TestView1Iterator");
    ViewObject vo = iter.getViewObject();
    for (int i=1; i<=5; i++) {
    Row newRow = vo.createRow();
    newRow.setAttribute("Id", i);
    ApplicationModule am = vo.getApplicationModule();
    am.getTransaction().commit();
    vo.executeQuery();
    Do I need to import something else?
    Thanks,
    Shri.

  • Add row in ADF table

    I'm trying to add a new row to ADF table. Here are my steps:
    1. Create new entities from tables (New -> EJB -> Entities from Tables)
    2. Create Session Bean (New -> EJB -> Session Bean) with all requested methods for earlier created entity
    3. Create Data Control out of it (right click on session bean -> Create Data Control) - it creates "testFindAll"
    4. After these steps, I drag&drop my "testFindAll" from data controls to form and create table
    5. Now, I drag&drop operation Create from my "testFindAll -> Operations", create button and change action from Create to CreateInsert
    And now, the troubles : ((.. When I click button to add new row I get null pointer exception. Here is part of trace:
    java.lang.NullPointerException
    at oracle.adf.model.adapter.bean.UpdatableBeanDataControl.createRowData(UpdatableBeanDataControl.java:137)
    at oracle.adf.model.bean.DCBeanDataControl.createRowData(DCBeanDataControl.java:642)
    at oracle.adf.model.bean.DCDataVO.doCreateData(DCDataVO.java:870)
    at oracle.adf.model.bean.DCDataRow.create(DCDataRow.java:306)
    at oracle.jbo.server.ViewRowImpl.callCreate(ViewRowImpl.java:432)
    at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:4679)
    at oracle.adf.model.bean.DCDataVO.createInstance(DCDataVO.java:567)
    at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1818)
    at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:2211)
    at oracle.jbo.server.ViewRowSetImpl.doCreateAndInitRow(ViewRowSetImpl.java:2257)
    at oracle.jbo.server.ViewRowSetImpl.createRow(ViewRowSetImpl.java:2233)
    at oracle.jbo.server.ViewObjectImpl.createRow(ViewObjectImpl.java:9404)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1223)
    at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2120)
    at oracle.adf.model.bean.DCBeanDataControl.invokeOperation(DCBeanDataControl.java:464)
    at oracle.adf.model.adapter.AdapterDCService.invokeOperation(AdapterDCService.java:307)
    at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:693)
    at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:217)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    I know that I it possible to do this if you create ViewObject instead of Entities from Tables and SessionBean. But I need this approach.
    Thanks a lot!

    Hi Goran,
    What is your JDev version? Are you trying with EJB 3.0 or 2.1? I just tried (with 3.0) and it is working fine (tested in JDev 11.1.1.2.0).
    Here is my pagedef
    <action IterBinding="deptFindAllIterator" id="Create"
                RequiresUpdateModel="true" Action="createRow"/>Infact, i don't have to change the Create action to CreateInsert. By default it was CreateInsert only.
    -Arun

  • Focusing a field/column in the new row of adf table

    Hi all,
         I am using JDeveloper 11.1.2.4.0. and UI-Shell Template in Main application and sub applications are added to this master application as ADF library jar files. Application is working fine.
    I am trying to focus to make focus on a column in the newly created row in one of the sub application by referring the below link
    http://adfnbpel.wordpress.com/2013/08/14/focusing-a-fieldcolumn-in-the-new-row-of-adf-table/
    I created a single application and found that its working
    But in my application focus is not working.
    When i checked the java script by using FireBug console it is found that comp = AdfPage.PAGE.findComponent(‘”+inputId+”‘); is getting as "undefined" , where inputId = table.getClientId(facesCtx) + “:” + rowId + “:” + “it3″; I am getting the exact row id also. When i tried with by passing the table id as input id like inputId = table.getClientId(facesCtx) ; the fire bug console then showing the table id. So its sound strange.
    What may be the cause of not able to find the input text it3 by using findComponent ?
    Is any body can suggest a solution for this.
    Thanks in advance,
    Gijith

    Hi,
    read up about "findComponentByAbsoluteLocator" in http://www.oracle.com/technetwork/developer-tools/jdev/1-2011-javascript-302460.pdf
    or check ...
    AdfPage JS doc
    Frank

  • How to set a row as default row in adf table

    Hi,
    I have a requirement: when page is launched there are multiple records with different status displayed on the page and i had to make the first record with Status = XXX as default selected row in adf table. How to code it?
    Thanks!
    Susan

    Hi Frank,
    Thanks a lot for your quick response!
    We are using Jdev 11g. After received your response, i went through all of your responses in ADF coner and OTN for the related topics (setting detail row) and got some ideas(Specially, i got your detail coding for moving makeCurrent expression into selection listener method into backing bean, etc ) and was ready for coding this function. But our PM changed their mind and we dont need this function. So, I had to move to another area......
    Your articles and your responses really help me!
    Thanks again for your help!
    Susan

  • Commit multiple rows of ADF table at once?

    Hi All,
    I’m using Jdeveloper 10.1.3.3 and ADF BC technology. I’ve created jsp which consist of ADF table and submit (commit) button. There is one column editable, where the user can choose from SelectOnechoice component the value Yes OR No. I tried to save all changes in each row at a time, in order to do that I used commit from Operations but the changing in first row is saved. How can I make the commit save all changes at once.
    Thanks in advance

    Hi,
    a commit is performed on the transaction, not the rows you see on the screen. So you need to make sure that changes get submitted using the autosubmit functionality or by submitting the form before pressing commit
    Frank

  • Fixed number of rows in ADF table

    Can we specify fixed number of rows for ADF table so even no rows displayed it will still show 10 empty rows.

    the rangesize property determines how many rows will be displayed and controls paging. If there are no rows to begin with (if I understand the question correctly) rangesize won't have any effect.

  • Pass current row data from table and pass it to a method in AM

    Hi All,
    I have a table with row selection enabled. Also for each row I have a select image which on selection should pass the data from one of the columns of the current row selected to a method in AM.
    Can anybody let me know on "How on selection of the image in any row, can I pass the column data to the method in AM?".
    Thanks,
    Vijay

    Hi,
    the most easiest and straight forward approach is
    - Ckick the "Binding" tab at the bottom of the Visual Editor
    - In the Bindings section click teh green plus icon and choose Generic Bindings | Attribute Value
    - point the iterator selection to the iterator used by the table
    - choose the column's attribute name from the list of attributes
    - Create a method on the ApplicatioNModule IMPL class (should take single argument)
    - expose it as a client interfaces so it shows in the Data Controls panel
    - In the "Binding" tab, create a method binding for this exposed method
    - point the method binding argument to #{bindings.column-attribute-name.inptValue}
    So whenever you need to pass the value on to the AM, you just call the method binding
    OperationBinding oper = (OperationBinding) bindings.get("name of method");
    oper.execute();
    Frank

  • How to get current row value from table when press the submit button

    Hi,
    I want to get the current row value of SuccessionPlanId which is one of the column in a advanced table.
    I created one button (created using personalization, action fired thru CO)in the table as column, so each row having one button, if i press the first row's button means then i want to fetch the first row's SuccessionPlanId and if it is 3rd means then i want to get the value of third row's value.
    How to do it in controller extension?
    Please reply soon, its urgent.
    Thanks in advance,
    SAN

    Pratap,
    Yes, I tried with 'delete' button which is seeded one.
    For this, our code using row reference is working too fine. it throws exact SuccessionPlanId value of corresponding row.
    I created MessageStyledText, but here i need to give text value right, then only it 'll appear in the page.
    Instead i created one image and fired explicitly from the controller processRequest method.
    But the same problem remains..
    here my code:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean){
    super.processRequest(pageContext, webBean);
    OAButtonBean oabb = (OAButtonBean)webBean.findChildRecursive("XXSubmit");
    FireAction action = new FireAction("XXSubmit");
    oabb.setAttributeValue(UIConstants.PRIMARY_CLIENT_ACTION_ATTR, action);
    OAImageBean oaib=(OAImageBean)webBean.findChildRecursive("XXSubmitImage");
    oaib.setFireActionForSubmit("XXSubmitImage", null, null, true);
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){
    if("XXSubmitImage".equals(pageContext.getParameter("event"))){
    String succIdI="";
    String rowRefI = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    if(rowRefI != null && !("".equalsIgnoreCase(rowRefI ))){
    PerSuccPlanSearchVORowImpl rowI = (PerSuccPlanSearchVORowImpl)oaam.findRowByRef(rowRefI);
    if(rowI != null)
    succIdI=rowI.getAttribute("SuccessionPlanId").toString();
    }else{
    throw new OAException("Row is null");
    throw new OAException(succIdI, OAException.INFORMATION);
    }else{
    super.processFormRequest(pageContext, webBean);
    If i run the page using this controller, it throws exception without any value, because for 'succIdI' i initialized without any string.
    Can you please suggest me how to solve?

  • Can we create a new row in a table using a down arrow

    Hi,
    I am using jdeveloper 11.1.1.6.
    For one of my project, I have a requirement where i need to create a new row in table using a down arrow. My client does not want to use mouse clicks. They want to use keyboard as much as possible.(Fast data entry).
    Is it possible to create a new row using down arrow. Any pointers will be helpful!
    Thanks,
    Umesh

    you can try this thing
    steps
    - capture downkey event - may b this help http://www.qualitycodes.com/tip/1/capturing-keys-with-javascript.html
    if not google more
    -then call from javascript call java method - https://blogs.oracle.com/jdevotnharvest/entry/how-to_call_server_side_java_from_javascript
    -then create new row of table VO .....

  • Call a method on row selection in table.

    Here is my use case:
    I have created my dc using a wsdl. I have a main page having a panel splitter which divides the page vertically. On the right panel I have created a dynamic region which displays result of task flows on clicking a task flow links present on the left panel. In one of the task flows i am displaying an adf table. My requirement is that on selecting a row in this table i want to call a method present in my dc which will take the value from selected row and should display the result depending on this input parameter received. I want its result to be displayed on the same page (below the table). How do i achieve this?
    -Pankaj

    Drag the method you want to invoke from the data control palette onto the table's column and drop it as a link there.
    This will create a component that when pressed will call the method.
    If instead you want to enable this through a selection of a line in the table - then you can write a selectionListener on the table that will do the same thing that the link does.
    (double click the link to generate its activation code in your backing bean).

  • Problem to create multiple rows in adf table.

    Hi All,
    i am using jdev version 11.1.1.5.0. i have facing very strange problem to create row on table.
    In my use case i have create row on table under loop statement. so no of rows created based on loop condition. each time on loop we supply diffrenet value for column like subpkgid,sno but row created with same value.
    code is following-
        public void createRowOptHdr()
                  boolean flag=false;
                ViewObject reqhdrvo= getService().getView("StmReqhdrView1Iterator");
               Row reqhdrrow= reqhdrvo.getCurrentRow();
                ViewObject pkglist= getService().getView("PkgListOptHdr1Iterator");         
               ViewObject tskcdvo= getService().getView("GetTskSubtskCd1Iterator");
                System.out.println("Subtype===>"+reqhdrrow.getAttribute("Subtype"));          
                tskcdvo.setNamedWhereClauseParam("stype",reqhdrrow.getAttribute("Subtype"));
                Row tskrow=tskcdvo.first();
                int count =pkglist.getRowCount();
                ViewObject opthdr= getService().getView("StmOpthdrView2Iterator");
                           opthdr.executeQuery();
                Row optrow=null;
                Row pkgrow=null;
                for(int i=1;i<=count;i++)
                    if(i==1)
                    pkgrow=pkglist.first();
                    else
                        pkgrow=pkglist.next();
                    if(pkgrow.getAttribute("Mark")!=null)
                 flag=(Boolean)pkgrow.getAttribute("Mark");
                    else
                        flag=false;
                    if(flag)
                        optrow = opthdr.createRow();  
            optrow.setAttribute("Reqdt",reqhdrrow.getAttribute("Reqdt"));
            System.out.println("Pkg Id====>"+pkgrow.getAttribute("Id"));
            String id=(String)pkgrow.getAttribute("Id");
            System.out.println("id val==>"+id);
            optrow.setAttribute("Pkgid",reqhdrrow.getAttribute("V_Pkgid"));
            optrow.setAttribute("Subid",id);
            optrow.setAttribute("Sno",opthdr.getRowCount());
            optrow.setAttribute("ReqStatus","WAIT");
            optrow.setAttribute("LHier",reqhdrrow.getAttribute("LHier"));
            optrow.setAttribute("Subtype",reqhdrrow.getAttribute("Lanweb"));
            optrow.setAttribute("Divn",reqhdrrow.getAttribute("Divn"));
            optrow.setAttribute("Status","Y");
            optrow.setAttribute("TaskCd",tskrow.getAttribute("TaskCd"));
            optrow.setAttribute("SubtaskCd",tskrow.getAttribute("SubtaskCd"));
            opthdr.insertRow(optrow);
            try
            optrow.validate();
            catch(Exception e)
                System.out.println("Error to validate opt hdr row===>"+e);
            //opthdr.executeQuery();
                } i have called this method on a button click so no of row selected on pkglist vo same no of row created. and these row are different pkgid but when i again select some row from pkglist and click on button thease row created with same sno ,subpkgid as first row.

    Have you used the debugger and dropped through the code?
    Have you checked that opthdr.getRowCount() returns a different value each time?
    Using the method isn't optimal as it will iterate over the towards each time. Next you'll get duplicate numbers if more then one user works with the application and end up clicking the button. You should use a sequence for this.
    Timo

  • How to get current row of Advanced table with no submit

    I have an advanced table with an 'Add another button'. When an empty row is created by clicking this button, LOV is used on the first column to populate other fields of the row. The rows of the table carry a button called "Add dependencies" whose functionality is to take the user to a different table to add rows to a different VO. This button is just a button and not a submitButton. I am passing the row's primary key as part of the URI as Vo attribute FdTaskId={@FdTaskId}
    The button works perfectly fine for database fetched rows (rows already present in the database), but, for the rows created using 'Add Another button', though LOV populates all fields including the primary key, the URI parameter passes null to the next page. That means, the VO attribute is not set. This works fine only when a 'submit' happens in the first page. For example, if I click Add another row again, then the previously inserted row passes the primary key fine as part of {@FdTaskId}.
    Could you please help me how I can resolve this issue?
    Thanks,
    Datta

    I am doing exactly that. My issues is that, VO attribute is passed correct for the table rows which are fetched from the database. For the table rows which got created through 'Add Another button', the VO attribute passed through URI as {@FdTaskId} is returning null. The VO attribute sets only when a form submit happens. For example, after adding a row through 'Add another row' button, click the same button again to add one more row and now go back to previously added row and now you can see that its VO attribute is set ({@FdTaskId} carries value )

  • How to get current row data in table control

    Hi , expert ,
       I am professional in oracle ,  but  now I am a new guy in SAP ABAP .
    I  have a question in UI
    How to get current row data and click pushbutton  in table control  to open next screen ?
    I want to get the current data and open next screen to carry out detail detail .
    Thansk for all your suggestion .

    GET CURSOR LINE SY-CUROW .
      READ TABLE internal_table index SY-CUROW.

  • Display and edit currently selected row of ADF Table in ADF Form

    I have an ADF Read-only Table and ADF Form, which were created from the same Data Control.
    I need to be able to edit the selected row of the table in the form (just like in "Binding Data Controls to your JSF page" part of "Developing RIA Web Applications with Oracle ADF" Tutorial). However, I can't figure out how to do this :(
    I found the following solution on the Web: #{bindings.DeptView1.currentRow.dataProvider.dname} - but it doesn't work, since "the class oracle.jbo.server.ViewRowImpl does not have the property dataProvider".
    Sorry for the newbie question.
    Thanks in advance for any help!

    Hi,
    AFAIK, dataProvider is not supported on ADF BC, hence the error.
    If you have created ADF Read only table and form from the same data control you just need to refresh the form based on table selection to show up the selected record, to do which you just need to add partialTriggers property to the panelFormLayout and set its value to the id of table
    Sireesha

Maybe you are looking for