9 Replies Latest reply: Feb 2, 2012 2:07 AM by 650570 RSS

    Jhs Lovs open new db connection

    650570
      We are using jheadstart 11.1.1.3.35. There is a need to minimise the database connections opened by the application. However we have noticed that all jhs LOVs in the application are opening a new database connection instead of using the db connection of the root application module. Is there any way to avoid this type of behaviour?

      Thanks
        • 1. Re: Jhs Lovs open new db connection
          Steven Davelaar-Oracle
          Can you provide a bit more info:
          - what is the (nested) structure of your application modules?
          - in which application module did you define the view object usage used by the LOV group?
          - what is the value of the Data Collection property in the LOV group?

          Steven Davelaar,
          Jheadstart Team.
          • 2. Re: Jhs Lovs open new db connection
            650570
            I have a single application module (no nested app modules inside). The view object usage for both the lov group and the main group are defined in this same application module.
            The value of the Data Collection property in the LOV group is the name of the View Object instance for example RegionsLookup.
            The first time i open the lov a new db connection is opened up. Also every time i open the lov, the method prepareSession of the ApplicationModule is called. This behaviour happens in
            every application where the jhs lovs are used but not when i use model-inputTextLovs.
            • 3. Re: Jhs Lovs open new db connection
              Steven Davelaar-Oracle
              This is standard ADF BC behavior. JHeadstart LOV's are simply using a VO instance. On each request prepareSession is called, just like on VO instances not used for LOV's.
              Build a sample app without JHeadstart and you will see the same behavior.

              Steven Davelaar,
              Jheadstart team.
              • 4. Re: Jhs Lovs open new db connection
                650570
                This standard ADF BC behavior you are referring to, is happening only when you set the jbo.doconnectionpooling to true which means that application module is disconnected upon release. However this is not the case in our applications where we are using the default application module configurations, where optimally the application module is session scoped (prepareSession method is called only once for each session).
                I am not really sure but i think that opening a new database connection has to do with the fact that all jhs-lovs are bounded task flows and the task flow's transaction option is set to <No Controller Transaction> instead of Always Use Existing Transaction option.
                I really wonder, am i the only one who encounters this behaviour about jhs-lovs?

                Cheers
                • 5. Re: Jhs Lovs open new db connection
                  Steven Davelaar-Oracle
                  if no controller transaction is specified (which by default is the case when using JHeadstart), the data control scope setting determines whether a new AM instance and associated DB connection is created. The default data control scope is "shared". Maybe you cnahged the data control scope setting at the application level, or for individual LOV groups?
                  That would explain the behavior you are seeing.

                  Steven Davelaar,
                  JHeadstart team.
                  • 6. Re: Jhs Lovs open new db connection
                    650570
                    Dear Steven,

                    I use the default configuration. Does it have to do that the development platform is linux, I doubt about it. In 5 applications using jheadstart 1.1.1.3.35 and jdeveloper 11.1.1.4.0, we encounter the same behaviour:
                    When we open a jhs lov for the first time a new connection spans. Then this connection is reused for any subsequent jhs lov calls.
                    So for every root application module with jhs lovs we always have 2 db connections (when we query v$session) instead of 1, so 5 root ams with jhs lovs will span 10 db connections.

                    I tried to change the transaction option to Always Use Existing Transaction but then a runtime exception is thrown:
                    ...
                    Caused by: oracle.adf.controller.activity.ActivityLogicException: ADFC-00006: Existing transaction is required when calling task flow '/WEB-INF/adfc-config-EmployeesLookupn.xml#EmployeesLookupnTaskFlow'.
                         at oracle.adfinternal.controller.activity.TaskFlowCallActivityLogic.validateModel(TaskFlowCallActivityLogic.java:908)
                    ...

                    Also the "share data controls with calling task flow" option for the individual Lov is always checked by default. How can i change the data scope setting at the application level?

                    I can send you a small test case i created to see for yourself.

                    Thanks
                    • 7. Re: Jhs Lovs open new db connection
                      Steven Davelaar-Oracle
                      yes, please send the testcase to idevcoe_nl@oracle.com

                      Steven Davelaar,
                      JHeadstart team.
                      • 8. Re: Jhs Lovs open new db connection
                        Steven Davelaar-Oracle
                        OK, found it.
                        The lov taskflow template includes

                        <data-control-scope id="__0">
                        <isolated/>
                        </data-control-scope>

                        This means that for every LOV a new AM instance will be created. The reason we set the data control scope to isolated is that it allows updateable LOV's, where a new row is inserted independent of the pending base page transaction.
                        So, if your LOV's are read-Only, you can customize the lov taskflow template and remove the isloated data control scope. It would be better to have this as the default, as most LOV's are readOnly, so we will change this for the next release.

                        Steven Davelaar,
                        JHeadstartTeam.
                        • 9. Re: Jhs Lovs open new db connection
                          650570
                          Yes, that solves everything!!!

                          Thanks again