1 Reply Latest reply: May 7, 2012 12:40 PM by 452071 RSS

    How to set the NLS in ADF for a session?

    user10047839
      Hello,

      Is there a built-in way to set the NLS parameters (Oracle-specific Date Format, Language..etc..) for the current DB session in ADF?

      thanks.
        • 1. Re: How to set the NLS in ADF for a session?
          452071
          Hi there,

          From your ViewController properties under Run you can add the following java option -Duser.timezone=CET. If you want to do it at the application level then you need to do the following:
          - In your AM override the prepareSession(Session session) method with custom code to set up your NLS
          - Create a class that implements the PagePhaseListener
          - Override beforePhase(PagePhaseEvent pagePhaseEvent) method to set the locale

          public void beforePhase(PagePhaseEvent pagePhaseEvent) {
          Integer phase = pagePhaseEvent.getPhaseId();
          if (phase.equals(ADFLifecycle.PREPARE_MODEL_ID)) {
          FacesContext facescontext = FacesContext.getCurrentInstance();
          String language =
          facescontext.getExternalContext().getRequestLocale().getLanguage().toUpperCase();
          FODApplicationModuleImpl.preferredLanguage = language;
          FODApplicationModuleImpl.isWebUser = true;
          }
          }

          Hope this helps.

          Juaan C.