3 Replies Latest reply on Jan 29, 2013 9:56 AM by myinception

    ADF Mobile:AdfmfJavaUtilities.getMethodExpression

      hi everyone,
      I'm using sqlite as local database in my adf mobile app,I use a Bean for saving some data,when i use "public void SaveContact()" definition i get no error and i can access my method by " AdfmfJavaUtilities.getMethodExpression("#{bindings.SaveContact.execute}", boolean.class, new Class[] { });" but when use "public boolean SaveContact()" i cannot access my method i get error method cannot be found,
      the reason that i want to use second definition is to find out if my data saved successfully or not and alert using "throw new AdfException("Saved", AdfException.INFO);",
      can anyone tell me how can i do that or at least show me a better way to alert succeed or error????

      Thanks in advance
        • 1. Re: ADF Mobile:AdfmfJavaUtilities.getMethodExpression
          Joe Huang-Oracle
          Hi, the reason is that executing method expression calls cannot return any value. You have probably seen the example in the employeeList Java class in the HR Sample app - using that example, the UI is calling SaveEmployee method that in term invoke SaveEmpToDB. The SaveEmptoDB in term can return success/failure back to SaveEmployee. There are examples of how to check for SQL errors and other type of errors in these method.

          Is the requirement to surpress the error messages that might be coming from DB saving code, but instead raise an error in your Managed Bean with ADFException error message?


          Joe Huang
          • 2. Re: ADF Mobile:AdfmfJavaUtilities.getMethodExpression
            Thanks for replying,
            Yes actually i want to inform user if the save done successfully or not...
            any solution????
            • 3. Re: ADF Mobile:AdfmfJavaUtilities.getMethodExpression
                  public String cb1_action() {
                      BindingContainer bindings = getBindings();
                      OperationBinding operationBinding = bindings.getOperationBinding("Commit");
                      Object result = operationBinding.execute();
                      if (!operationBinding.getErrors().isEmpty()) {
                          FacesContext context = FacesContext.getCurrentInstance();
                          FacesMessage fms = new FacesMessage(FacesMessage.SEVERITY_INFO, "Error in Saving Records.", "");
                          context.addMessage(null, fms);
                      else {
                          FacesMessage fms = new FacesMessage("Records Saved Succesfully");
                          FacesContext context = FacesContext.getCurrentInstance();
                          context.addMessage(null, fms);
                      return null;