Direct call from Session Bean vs invoking the binding to call the SB

This question is directed to a method to handle the call to the bean to support rather than using the input fields and the provided button by dragging the method on the data control.

One is better than the other?

It is better to think that...

bean.getMyFinderMethod ("parm1", "parm2");

Note: where getMyFinderMethod is the same value as getMyBinding in the comparison

that whole...

DCBindingContainer dcBindings = (DCBindingContainer) this.getBindings ();
OperationBinding operationBinding = (OperationBinding) this.getBindings () .getOperationBinding ("getMyBinding");
Map params = operationBinding.getParamsMap ();
params.put ("parm1", parm1);
params.put ("parm2", parm2);
Object result = operationBinding.execute ();

your opinion is welcome...

Hello

If you work with the ADF, then all calls should be through the ADF link layer, the OperationBinding class. If you bypass the link layer, then a State indicated on a view of the application related to the ADF may be out of synchronization with the State in business. In addition, you won't to anyone doing a favor by using two different API in your application and development instead of make your code hard to read

Frank

Tags: Java

Similar Questions

  • Why the method in the several times called session bean

    Hello
    I work with Jdev 11 g.
    I created an example Web J2ee Application.
    In the model project, I created:
    1 - entity Bean
    2 - stateless session bean (which contains a method that get the list of username == > em.createNamedQuery("OsaUser.findAll").getResultList ();)

    In the view controller project I created:
    1 - managed bean, session scope, a getter that calls the session bean and retrieve the result of the query.
    2 - a JSF page with af:table element with the value bound to the list in the managed bean.

    When I run the application, the data is displayed, but since I put system.out message I get this message several times.
    When I try to debug the application the breakpoints on the managed bean and session bean are available several times.

    Can you please advice why this happens.
    Concerning
    Emile BITAR

    Hello

    partially, it's the cycle of life and partially a known bug. The method is called during ApplyRequest and RenderResponse. If you check this in your output, so you see that make answer calls at least three times, which is the bug that we set. As a temporary work around, set a flag within the scope of the request (since your bean's scope of session that you use a requestScope attribute). The first time you run, you set the attribute flag. So every time its called again, you check to see if the indicator exists and if ignore the request. Because the flag is set to request scope, you needn't clean it explicitly

    Frank

  • To access the Session Bean?

    Hello

    With the help of Jdev 11.1.1.7.0. mrequirement is I need to access session Bean on the Module of the Application.


    so I use this way in my implementation of the application module class .

    SessionBeanClassName sessionBeanClassObject is JsfUtils.getManagedBean ("recorded in the adfc-config sessionBeanName").

    I can able to access via the module of the application.

    My question is:

    1. is this good sense?

    2. No Impact on this approach?

    3. is this a good practice?

    4 is one way to access the variable from Session Bean on the application module.

    Thank you.

    Q2) the impact is that you break the mvc pattern and therefore the model of coupling to the display. Later, this can be a problem because your application doesn't fit. Add pass you ui state model (am) you might encounter problems when querying comes into play.

    Sample of Q4) Chris did not access to a bean in scope session leave an application module, but how to get there from an another view layer bean.

    Joel Ramamoorthy-Oracle and Cvele_new_account and myself you asked before, without a real use case all we can say is: don't access scope the model layer session bean.

    Timo

  • Failed to retrieve the scope session bean

    Hello
    I'm working on JDeveloper 11.1.1.6.0.

    I use a session bean extended for the storage of information about the logged-on user. I have a page and a reading of the data of this extended session bean managed bean. It works very well. But now, I created another page also using the bean managed to read the data of the extended session bean. But he always returned null for the bean.

    Anyone has an idea why this might happen? It is not really clear to me why she is working with the first page and not with the second page, even when they both use the 'same' bean managed.

    Thanks in advance.
    Alex

    Alex,

    Kind of how convoluted to get a reference to a bean.

    Have you tried to create a managed property in the bean where is your code (set the value of the property #{SessionBean} in faces-config.) (XML)?

    John

  • [Session beans] Can't make matters!

    Hello
    I created a simple session bean and find the method works very well. Problem comes with queries... I tried to make this simple query:
    Query query = em.createQuery("from Employee e where e.name='myName' ")
    but I have this exception:
    >
    GRAVE: [!] EXCEPTION!] An exception occurred while creating a query in EntityManager:
    Description of the exception: syntax error parsing of the request [from employee e where e.name = 'myName'], line 1, column 0: unexpected [in] token.
    Inner exception: NoViableAltException(33@[])
    >

    and this applies to all the queries that I do... I tried different others, but the result is always the same...

    HQL, you can drop the 'select' clause, but I don't think you can do this in the JPA query language. have you tried something like "select employee e where e.name = 'myName'?"

    More examples here http://docs.oracle.com/javaee/5/tutorial/doc/bnbtg.html.

    Published by: jtahlborn on April 13, 2012 13:01

  • Migrate directly or from a backup?

    When dies a Mac - if the hard disk is OK - should migrate directly or from a backup?

    The new Mac check the old file system log to make sure that everything is OK and put the data back in an audited?

    I think that if the Mac died suddenly, I don't know if that hardware problem may affect the data on the hard drive, then perhaps that supports to switch over to a backup. But then there is always the possibility that there could be a problem with the backup. (We have a backup that is no more than an hour old.)

    Thank you in advance!

    If possible I would like to migrate directly, the backup is a good option when you cannot.

  • Invoke the bean of calendar (from Oracle) on the TIMING of the CLICK of MOUSE events in a text box

    Hello
    I want to get the date the user has selected in a calendar of bean (supplied by Oracle), currently my practice is to put a bean for each calendar and after date selection I am pushing this field required date, suppose I need calendar half dozen in my form I have to place the beans a half dozen, basically I don't want user of bean rather , I want him to click on the text box then CLICK event, it will display a calendar of the bean click and on the selection value will return to the text element.
    Please guide is it possible if yes how.

    Version of Oracle Forms. 10.1.2(webutil installé)
    Database. Oracle 10g Enterprise


    Thank you and best regards,
    Syed Khawar

    now when the user clicks on bean, it appears calendar through trigger WCIE

    It's a way to view the calendar of Java, however, you can simply place a button on your canvas for each calendar you wish to view and then in the trigger Button-When-Pressed (WBP) to run code similar to the following:

    /* Code example assumes you have a CONTROL block with a */
    /* block Item called: CALENDAR_ITEM, which will act as a variable */
    /* to record which date item the Java Calendar was called for. */
    BEGIN
       :CONTROL.CALENDAR_ITEM := 'MY_BLOCK.DATE1';
       Set_Custom_Property('CALENDAR.BEAN_AREA',1,'SHOW_CALENDAR','50,50);
    END;
    

    This code displays the calendar and assign the value "DATE1" to your 'Variable' control block, so that you know what Date is your calendar was called for. Then, in your trigger when-Custom-point-Event (WCIE), you manage the date returned by your calendar of Java Bean and assign the value to the element of date in your CONTROL. Field of Calendar_Item.

    DECLARE
      v_event_name      VARCHAR2(30) := :SYSTEM.Custom_Item_Event;
      v_event_vals      ParamLIst;
      n_event_val_type  NUMBER;
      jb_date           VARCHAR2(256);  -- Complete Date as returned by the JavaBean
      d_formated_date   DATE;
      jb_day            VARCHAR2(256);  -- Day Number (1-31)
      jb_month          VARCHAR2(256);  -- Month Number (1-12)
      jb_year           VARCHAR2(256);  -- Year Number (YYYY)
    BEGIN
      IF ( v_event_name = 'CALENDAR_EVENT' AND :CONTROL.Calendar_Item IS NOT NULL ) THEN
        v_event_vals := Get_Parameter_list(:SYSTEM.Custom_Item_Event_Parameters);
        Get_Parameter_Attr(v_event_vals, 'CALENDAR_EVENT_DATE', n_event_val_type, jb_date);
        Get_Parameter_Attr(v_event_vals, 'CALENDAR_EVENT_DAY', n_event_val_type, jb_day);
        Get_Parameter_Attr(v_event_vals, 'CALENDAR_EVENT_MONTH', n_event_val_type, jb_month);
        Get_Parameter_Attr(v_event_vals, 'CALENDAR_EVENT_YEAR', n_event_val_type, jb_year);
    
        /* The variable JB_DATE contains the full date formated as MONTH DD, YYYY */
        /* Our date format is different, so I get the elements of the date in the */
        /* jb_day, jb_month, jb_year variables so I can format them the way I need them. */
        d_formated_date := TO_DATE(jb_month||'/'||mb_day||'/'||jb_year,'mm/dd/rrrr');
        COPY(d_formated_date, :CONTROL.Calendar_item);
      END IF;
    END;
    

    This code example will allow you to use a single area of bean to support several calendar items on a canvas. If you have more than one canvas and you have an element of date on each canvas, you would need a surface of bean / canvas.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • How to set the session bean of backing bean variable

    Hi all -

    I have a bean with a session variable and I want to set the value of this variable to a bean of support. Could someone please suggest how to achieve this.

    I use ADF 11 g.

    Greetings-
    Rohit

    Hello

    First of all, you need get the referral of bean in the bean to support session, and call the method that sets the value of the attribute. Getting session bean reference - you can use dependency injection, which is the best way, but you must register your bean in faces-config. XML (not adfc - config.xml, see http://biemond.blogspot.com/2010/04/ejb-injection-in-jsf-managed-bean.html).
    An alternative is to search the session bean's JNDI.
    Third option involves data controls: you create a session bean data control and then expose the method to fix your attribute value, in the calling page to jspx pageDef. To do this, you can't use method that begins with 'set', because you will not be able to exhibit in the pageDef (at least not with the Visual Editor). Then, you can call this method from the bean to support using this code:

            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            OperationBinding operationBinding = bindings.getOperationBinding("yourSessionBeanMethodExposedInPageDef");
            operationBinding.execute();
    

    I hope this helps.
    Pedja

  • Invoking the CreateInsert of a managed bean

    Hi all

    I'm trying to call a CreateInsert operation on a view of a method object in a managed bean. The method is assigned as the actionListener for a toolbar button. For this, I modified the file xxxPageDef.xml with the wizard, who introduced something like this:

    & lt; action = "CommercialReferenceVO1Iterator" id = "CreateInsertPepe" IterBinding
    InstanceName = "DesignRequestAMDataControl.CommercialReferenceVO1"
    DataControl = "DesignRequestAMDataControl" RequiresUpdateModel = "true".
    Action = "createInsertRow" / & gt;
    & lt; / code & gt;

    I invoke the method using the EL from Steve Muench class as follows:

    EL.invokeMethod ("#bindings. CreateInsertPepe.execute', null (class), null);

    I do something appropriate? Because the truth is, it does not work :)

    What I really need, is create and insert a new row into an object of the detail view, and then change the tab currently selected programmatically to display the edit page for the new line.

    I hope that my question is at least some logic...

    Thank you!

    Juan Manuel

    Try this code in your method of action/actionListener managed bean:

    OperationBinding createInsertOp = (OperationBinding)getBindings().get("CreateInsertPepe");
    createInsertOp.execute();
    

    The code only inserts the line. Programatically displaying the edit page for the new line it is something else. If my suggestion is to execute the code inserts really the only line. If its ok, then just add the code that automatiaclly displays the edit page. In this way we can isolate the problem.

    Make sure the CommercialReferenceVO1Iterator is in the iterator header for the CreateInsert to work on a ViewObject detail.

    Another thing is that in your pagedef, I noticed the action links, the 'Action' attribute has the value "createInsertRow". You use charger 11 g? I don't know if its new in 11g but I use ADF 10 g and the attributes of 'Action' have numeric values, where a CreateInsert operation would have an Action = "40".

    Best regards

    Anton

  • [ADF, JDev12.1.3] viewScope bean can not recover sessionScope bean. Why? (How to day uploading of a session bean scope whenever a page with params is called)

    Hallo,

    to the login page of my application, I created a viewScope managed bean loginView.

    In the login page, I put a "dummy" inputText (whose value is related to dummyInitEditValue bean attr) to perform lazy loading of the page itself.

    In the initData() function I call a function of a bean sessionScope connection which should initlialize some of its attributes.

    public class LoginView {
      private Integer dummyInitEditValue;
    
      public LoginView() {
      }
    
      private void initData() {
        Login loginBean = (Login) FacesUtils.getManagedBeanInSession("login"); // loginBean = null !!!
        loginBean.initData();
        dummyInitEditValue = 1;
      }
    
      public void setDummyInitEditValue(Integer dummyInitEditValue) {
        this.dummyInitEditValue = dummyInitEditValue;
      }
    
      public Integer getDummyInitEditValue() {
        // Per lazy loading
        if (dummyInitEditValue == null)
          initData();
        return dummyInitEditValue;
      }
    }
    
    
    

    The problem is that the initData() rises a null pointer exception because the bean connection is not found.

    What's not in my approach?

    I create this hoping to resolve this issue: the login page has 2 URL parameters (defined in his point of view in the config.xml file - adfc) and I have according to them I need to update some of the bean sessionScope uploading connection every time the page is called / refreshes (possibly with new values for the parameters).

    BdW I do not know if there is a better alternative you can advice me.

    Thank you

    Federico

    Well, you need to instantiate bean connection somehow.

    You can try to link an attribute of connection bean to the page and see if this will help or you can try to resolve expression programmatically (something like #{connection}).

    Or you can try adding session bean defined as managed property for your bean view extended (something like this: http://umeshagarwal24.blogspot.ba/2012/09/using-managed-property-to-evaluate.html).

    Dario

  • Reports from Oracle 10 g in the OAS, calling using the URL method

    Hello

    I have my file of rdf report deployed on OAS 10 g. I am trying to invoke the servlet URL report using my java application. I want the report to display on the browser directly in PDF format. Instead, when I type the URL, I get a screen asking me to enter report parameters. I have provided the parameters in the URL, but this is display shows always when I type the URL. Is there anyway I can skip this screen and view the PDF file directly?

    The URL is:

    http://servername:7773/reports/rwservlet? server devserver & ORACLE_SHUTDOWN = YES & PARAMFORM = yes & report = test.rdf & desformat = pdf & desname = test.pdf and destype = pdf & userid=scott/tiger@devdb & param1 = 06889

    When I invoke this URL from a java application, I need to directly the PDF file and not the report parameters screen. Thanks in advance.

    It works if you do not include paramform = yes? or maybe try paramform = no

    also, I think that this should be destype = cache not pdf. PDF is already in desformat = pdf

    either way, what is oracle_shutdown? What is a user setting?

  • Error during the generation of session bean

    Hi all

    EPCO: 12.1.1.1.0

    I created the entities JPA through the Assistant of "JPA entities from Tables" for employees and departments.
    Now, I want to create the bean in session using the Wizard "Session Bean of JPA entities.
    I give it a name and select all of the available features and click on "Finish". Then I got the following error:
    Error running the session bean generation task.
    In the console error log, I see the following:
    org.eclipse.core.commands.ExecutionException: 
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectFromExistingDataModelOperation.execute(EJBProjectFromExistingDataModelOperation.java:67)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.addEJBFacetOperation(NewSessionBeanFromEntitiesWizard.java:249)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.createNewServiceDefnAndGenBeans(NewSessionBeanFromEntitiesWizard.java:219)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.doFinish(NewSessionBeanFromEntitiesWizard.java:169)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard.access$0(NewSessionBeanFromEntitiesWizard.java:160)
         at oracle.eclipse.tools.adf.view.ui.internal.wizard.datamodel.NewSessionBeanFromEntitiesWizard$1.run(NewSessionBeanFromEntitiesWizard.java:133)
         at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
    Caused by: org.eclipse.core.runtime.CoreException: 
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectConverter.convert(EJBProjectConverter.java:281)
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectFromExistingDataModelOperation.execute(EJBProjectFromExistingDataModelOperation.java:61)
         ... 6 more
    Caused by: java.lang.NullPointerException
         at org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider.hasValidRuntime(J2EEModuleFacetInstallDataModelProvider.java:213)
         at org.eclipse.jst.j2ee.project.facet.J2EEModuleFacetInstallDataModelProvider.propertySet(J2EEModuleFacetInstallDataModelProvider.java:162)
         at org.eclipse.jst.j2ee.internal.ejb.project.operations.EjbFacetInstallDataModelProvider.propertySet(EjbFacetInstallDataModelProvider.java:137)
         at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl.internalSetProperty(DataModelImpl.java:182)
         at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl.setProperty(DataModelImpl.java:172)
         at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelImpl.setStringProperty(DataModelImpl.java:201)
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectConverter.convert(EJBProjectConverter.java:126)
         at oracle.eclipse.tools.webtier.ui.wizards.existing.EJBProjectConverter.convert(EJBProjectConverter.java:273)
         ... 7 more
    Anyone has any idea what happened and how can I fix?

    Thank you in advance.

    Filip Huysmans.

    To work around this problem, follow these steps:
    -On the model JPA project
    RT - click on, and then select Properties
    -Select project facets
    -Unlock and deselect the facet utility Module
    -Select the facet of the EJB Module and Oracle WebLogic EJB Extensions

    Your project must be ready to perform the given operation.

  • Invoke the task from another process definition - is this possible

    Is it possible to invoke the task from another process definition?
    PD1 has task1
    PD2 has task2
    Call PD1.task1 from PD2.task2

    If possible, then what method API should I use.
    Thank you!

    Can you give me the right answer on this post :)

    -Kevin

  • invoke the action called more times

    Hi all
    I use call action that runs the query with parameters of request and extracts in a scope of the request bean. The problem is that the action is executed more than once during a single request. I tried all the value of possible action to invoke refresh. I also tried to put the table in a region "page fragment, but it does not help." The action called even when the table is scrolled.
    RefreshCondition property does not help, because it is too complicated to define whether or not this is the first call.
    Is it possible to invoke the action only once after receiving the request?
    Thank you
    SNikiforov
    11.1.1.2.0

    Use a workflow and to action invoke as a step in the workflow.

    John

  • Session bean behaves as ask the Bean

    Hello, I met this stange behavior in my Application (JDeveloper 10.1.3.3).
    I have a jsp page that contains an element of SelectOneChoice:

    + < af:selectOneChoice inlineStyle = "margin: 10.0pt +;
    autoSubmit = "true" simple = "false".
    unselectedLabel = "sΘlectionner".
    + Binding = "#{backing_page.versionsSelectOne}" +.
    + id = 'Refresh' label = 'Versions' / > +.

    As you can see, this article is bound to a field in the bean of support for this page (which we will call the)
    Bean "PageBean"). The binding object is:

    + private CoreSelectOneChoice versionsSelectOne; +

    "PageBean" is a session, stated in faces - config.xml bean:

    + < managed-bean > +.
    + < managed-bean-name > backing_page < / managed-bean-name > +.
    + < managed-bean-class > mypackage. PageBean < / managed-bean-class > +.
    + session < managed-bean-scope > < / managed-bean-scope > +.
    + < / managed-bean > +.

    In the constructor of 'PageBean', I create a new Istance of the component:

    + Application apps = FacesContext.getCurrentInstance () .getApplication (); +
    + versionsSelectOne = (CoreSelectOneChoice) apps.createComponent (CoreSelectOneChoice.COMPONENT_TYPE); +

    The bean of support (in a method called by a button), I dynamically fill the CoreSelectOneChoice with the
    components (CoreSelectItem) I want to display in the drop-down list.

    Everything works fine BUT the "PageBean' is now recreated to * each request * (despite that it is a * Session * Bean).
    If I remove the CoreSelectOneChoice creation in the costructor, it still behaves like a Sesison Bean.
    This behavior is very strange, and it seems to be somehow connected to the CoreSelectOneChoice component.
    even if I see no Exception in my application.
    Does anyone have an idea on what is happening?

    Hi Antonio,.

    >
    (1) usually when I create a page, I can creata a support for the page bean. Can I keep the information contained in
    the bean for 4 different extended (zero, request, session, application), let'say that I am interested in session and demand.
    I thought that the components of support where like that, and JDev encourage to put then in a backing bean
    using "automatically expose UI components in a new Managed Bean. So my idea of a support of the bean internally who can manage the
    components of the user interface on the session's not going, and I have to do a new design for this application...
    Well, JDeveloper is incredibly bad on this part, so why this option is not hidden and disabled by default in 11g, unlike the step of creating the standard and active in 10 g. Normally, you very rarely use the JSF binding attribute unless the refresh PPR component, allows you to wire the values in place like EL:

    
    
    
    
    // The classes
    public class MyDataBean
    {
        private String name;
    
        public String getName()
        {
            return name;
        }
    
        public void setName(String name)
        {
            this.name = name;
        }
    }
    
    public class MyControllerBean
    {
        private MyDataBean data;
    
        public String save()
        {
            // Call the model layer to save the data in MyDataBean
            return "success";
        }
    
        public MyDataBean getData()
        {
            return data;
        }
    
        public void setData(MyDataBean data)
        {
            this.data = data;
        }
    }
    
    
    
      data
      MyDataBean
      session
    
    
      controller
      MyControllerBean
      request
      
        
        MyDataBean
        #{data}
      
    
    

    (2) I'm not here. If the component (for example CoreSelectOneChoice) class is not a managed bean of JSF,.
    How can we instantiate frame it? In any case, I had a nullpointexception if I try to set a property of the
    component (CoreSelectOneChoice) in the bean to support, without the first instantiation of it.
    You must set the properties in the binding Set accessor method:

    public class BackingBean
    {
        private CoreSelectOneChoice choice;
    
        public CoreSelectOneChoice getChoice()
        {
            return null; // safer than returning choice in case 2 pages binds on the same bean
        }
    
       public void setChoice(CoreSelectOneChoice choice)
       {
           this.choice = choice;
           this.choice.setLabel("Foo"); // Here, in the setter, NOT in the constructor so JSF instantiate the component, not you.
       }
    }
    

    (3) ok I can do it by hand, but it reminds me of something that it is done automatically by spring.
    Thanks for your reply.
    JSF 2.0 and JSR-299 allow injection using the annotation, but Spring does not automatically, you must configure the spring to do, same goes for the JSF.

    Kind regards

    ~ Simon

Maybe you are looking for