3 Replies Latest reply: Jul 26, 2013 3:44 PM by Rudy Meyer RSS

    Two model projects (1 for Oracle, 1 for SQLServer) with 1 view project?

    Rudy Meyer

      We are trying to solve the issue of supporting both Oracle and SQLServer backends with our ADF application.  We have read many posts and our application is working against Oracle but have some issues with SQLServer.  The entities are created as SQL92/Java.  Would a better approach be to create separate model projects and then load or build with the appropriate one.  Each would have identical naming so the view would work with either.  At run time we know which type of db is installed. If this was to work how would we specify one over the other when building/running? 

       

      If I am way off on this idea please let me know and we will continue down the current path.

      Thank you

      Rudy

        • 2. Re: Two model projects (1 for Oracle, 1 for SQLServer) with 1 view project?
          Rudy Meyer

          Hi Shay,

           

          Yes, I have been through that document and done everything except the primary key generation.  Our db's do use the Identity/Sequence features for generating primary keys and this cannot be changed due to legacy systems that also access the db.  The error I see against SQLServer when performing a Commit after a CreateInsert, Update, or Delete is this:

           

          <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5

          javax.faces.el.EvaluationException: oracle.jbo.JboException: [oracle.jbo.DMLException: JBO-26080: Error while selecting entity for GetValueRuleEO]

              at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:58)

              at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1256)

              at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)

              at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)

              at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)

          ....

           

          This happens against multiple entity objects.  The entity PK's are defined as oracle.jbo.Domain.DBSequence with Updatable as Never and no Refresh. Is there a way to set the properties of the application model at runtime, possibly within the initialization servlet?

           

          Thank you.

          • 3. Re: Two model projects (1 for Oracle, 1 for SQLServer) with 1 view project?
            Rudy Meyer

            I set my debug level to FINEST and this line happens prior to the exception above:

            <SQLServerException> <logException> *** SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. Msg 1003, Level 15, State 2, Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.

             

            Googling this I found this link in the forum:  ADF and MSSQL 2005 problems -> FOR UPDATE clause allowed only for DECLARE C

            My entities were created with SQL92 and Java.  There is no answer to how he made out.

             

            So I think I the app is still trying to run against an Oracle db since the "for update" is Oracle related.  My driver class is com.microsoft.sqlserver.jdbc.SQLServerDriver and the library is Sqljdbc4.jar.

             

            Any ideas are welcome!