Topic
6 replies Latest Post - ‏2012-12-06T18:48:19Z by kolban
SystemAdmin
SystemAdmin
7615 Posts
ACCEPTED ANSWER

Pinned topic Best way to call database from coach view

‏2012-12-06T11:31:36Z |
Hi, I wanted to ask what is the best way to do database calls and fill tables, from a user interface (say, clicking a button, or after changing the selected item on a drop down list).

I would proceed this way: at the button click, the process should change step to a SQL Execute Statement, which takes the input from the former step (the user step); then, the db call is done, and the process goes to a next step, where the coach is reloaded with the data coming from the DB.

Is there a better way to do things? Like, perhaps, not needing to make a second User Step where we reload the data?

Is the procedure I described, the more proper way to work on BPM for this issue?

Thanks!!
Tony
Updated on 2012-12-06T18:48:19Z at 2012-12-06T18:48:19Z by kolban
  • kolban
    kolban
    3314 Posts
    ACCEPTED ANSWER

    Re: Best way to call database from coach view

    ‏2012-12-06T16:32:31Z  in response to SystemAdmin
    Hi Tony,
    Sounds like you have the recipe about right. In IBM BPM 8 with the fantastic new Coach View technology, we have the concept of a "Boundary Trigger". This basically means that certain events performed by the user in the UI result in a return back to the Human Service. The Human Service can then make any data queries it needs to update variables and return back to the Coach. Any changes to the variables cause corresponding updates to the fields in the Coach.

    So ... for example ...

    Click a button ... causes a boundary trigger ... causes a Nested Service to be called ... causes a SQL query ... results stored in a variable (eg. a list) ... now we return to the original Coach ... which has a table ... which is bound to the list variable ... which recognizes that the data has changed ... which redraws itself to show the new data.

    The technology is all Ajax and Web 2.0 based and appears to be pretty darn efficient.

    Again, this is just a summary response ... but you have come to the right place through this forum. There are lots of us here who will be happy to discuss (note this is different from answer :-) concepts in this area. I for one am fascinated by this whole Coach UI technology.

    Neil
    • SystemAdmin
      SystemAdmin
      7615 Posts
      ACCEPTED ANSWER

      Re: Best way to call database from coach view

      ‏2012-12-06T16:42:05Z  in response to kolban
      Hey Neil

      thanks, it's perfectly clear. The whole datasource concept (Ajax based) reminds me of when I was an ASP.NET developer a couple of years ago.

      Best,
      Tony
      • SystemAdmin
        SystemAdmin
        7615 Posts
        ACCEPTED ANSWER

        Re: Best way to call database from coach view

        ‏2012-12-06T17:56:25Z  in response to SystemAdmin
        Hey Neil,

        it's a bit off topic, but... did you ever incur into this exception?
        org.omg.CosNaming.NamingContextPackage.NotFound

        Looks like I am not setting up my JDBC correctly. I am using a SQL Execution Statement (see attached)...
        Thanks.. :)

        This is the whole stack trace:

        Process ID: Refhttp://716a1f35-df37-4ece-ac7f-9340c93fa2e9/TWProcess.8ca80af0-a727-4b90-9e04-21b32cd0c65c
        Process GUID: guid:d7766b7587753602:-9d2f0f9:11586bfc263:-7f74
        Error timestamp: Dec 6, 2012 12:49:33 PM
        Instance ID: BPDInstance.253
        Task ID: Task.203
        Root snapshot ID: null
        Snapshot ID: Snapshot.154c0858-d18a-4c01-9574-3c7cd96fd967
        Branch ID: null
        com.lombardisoftware.component.common.workflow.WorkflowProcessItemException: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
        at com.lombardisoftware.component.common.workflow.ExecutionJob.doJob(ExecutionJob.java:421)
        at com.lombardisoftware.server.ejb.workflow.EJBWorkflowManagerBean.doResumeWorkflowEngine(EJBWorkflowManagerBean.java:1045)
        at com.lombardisoftware.server.ejb.workflow.EJBWorkflowManagerBean.resumeTask(EJBWorkflowManagerBean.java:328)
        at com.lombardisoftware.server.ejb.workflow.EJBWorkflowManagerBean.resumeTask(EJBWorkflowManagerBean.java:292)
        at com.lombardisoftware.server.ejb.workflow.EJSRemoteStatefulEJBWorkflowManager_82478d70.resumeTask(Unknown Source)
        at com.lombardisoftware.server.ejb.workflow._EJBWorkflowManagerInterface_Stub.resumeTask(_EJBWorkflowManagerInterface_Stub.java:287)
        at com.lombardisoftware.component.common.workflow.EJBWorkflowManagerDelegateDefault.resumeTask(EJBWorkflowManagerDelegateDefault.java:94)
        at com.lombardisoftware.component.common.workflow.EJBWorkflowManagerDelegateWebSphere$4.run(EJBWorkflowManagerDelegateWebSphere.java:68)
        at java.security.AccessController.doPrivileged(AccessController.java:254)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper.doAsCurrentSubjectContextSensitive(WebsphereDelegateHelper.java:175)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper.doAsCurrentSubjectContextSensitive(WebsphereDelegateHelper.java:159)
        at com.lombardisoftware.component.common.workflow.EJBWorkflowManagerDelegateWebSphere.resumeTask(EJBWorkflowManagerDelegateWebSphere.java:66)
        at com.lombardisoftware.bpd.runtime.engine.quartz.ExecuteSystemLaneActivityTask$1.run(ExecuteSystemLaneActivityTask.java:70)
        at java.security.AccessController.doPrivileged(AccessController.java:288)
        at javax.security.auth.Subject.doAs(Subject.java:573)
        at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:195)
        at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:152)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper.doAs(WebsphereDelegateHelper.java:150)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper$4.run(WebsphereDelegateHelper.java:117)
        at java.security.AccessController.doPrivileged(AccessController.java:254)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper.doAs(WebsphereDelegateHelper.java:112)
        at com.lombardisoftware.bpd.runtime.engine.quartz.ExecuteSystemLaneActivityTask.execute(ExecuteSystemLaneActivityTask.java:89)
        at com.lombardisoftware.server.scheduler.Engine.execute(Engine.java:746)
        at com.lombardisoftware.server.scheduler.Engine.access$300(Engine.java:72)
        at com.lombardisoftware.server.scheduler.Engine$1.run(Engine.java:468)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper$2$1.run(WebsphereDelegateHelper.java:78)
        at java.security.AccessController.doPrivileged(AccessController.java:288)
        at javax.security.auth.Subject.doAs(Subject.java:573)
        at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:195)
        at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:152)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper.doAs(WebsphereDelegateHelper.java:150)
        at com.lombardisoftware.client.delegate.common.WebsphereDelegateHelper$2.run(WebsphereDelegateHelper.java:74)
        at com.lombardisoftware.server.scheduler.Utils$EJBThreadRootRunnable.executeRunnable(Utils.java:113)
        at com.lombardisoftware.server.scheduler.ThreadPool$Worker.run(ThreadPool.java:130)
        at java.lang.Thread.run(Thread.java:769)
        Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
        at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:568)
        at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2169)
        at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:538)
        at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2957)
        at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2953)
        at com.ibm.ws.naming.util.CommonHelpers.retry(CommonHelpers.java:801)
        at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:2951)
        at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1817)
        at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1776)
        at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1433)
        at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:615)
        at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:165)
        at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
        at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
        at javax.naming.InitialContext.lookup(InitialContext.java:436)
        at teamworks.sql.SQLExecutor.getConnection(SQLExecutor.java:60)
        at teamworks.sql.SQLExecutor.execute(SQLExecutor.java:77)
        at teamworks.SQLConnector.execute(SQLConnector.java:229)
        at teamworks.SQLConnector.executeFlat(SQLConnector.java:244)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at teamworks.connector.JavaReflectionConnector$1.execute(JavaReflectionConnector.java:81)
        at com.lombardisoftware.server.core.ManagedAssetClassLoaderUtil.executeWithManagedAssetClassLoader(ManagedAssetClassLoaderUtil.java:53)
        at teamworks.connector.JavaReflectionConnector.execute(JavaReflectionConnector.java:49)
        at com.lombardisoftware.component.javaconnector.worker.JavaConnectorWorker.invokeJavaMethod(JavaConnectorWorker.java:149)
        at com.lombardisoftware.component.javaconnector.worker.JavaConnectorWorker.doJob(JavaConnectorWorker.java:82)
        at com.lombardisoftware.component.common.workflow.ExecutionJob.doJob(ExecutionJob.java:409)
        ... 34 more
        • kolban
          kolban
          3314 Posts
          ACCEPTED ANSWER

          Re: Best way to call database from coach view

          ‏2012-12-06T18:36:36Z  in response to SystemAdmin
          Did you define a Data Source in WAS through the admin console for the JNDI entry known as "jdbc/MORTGAGE"?

          Neil
          • SystemAdmin
            SystemAdmin
            7615 Posts
            ACCEPTED ANSWER

            Re: Best way to call database from coach view

            ‏2012-12-06T18:45:54Z  in response to kolban
            Hahaha, thanks Neil! Looks like I had forgotten one of the most obvious things! :D
            • kolban
              kolban
              3314 Posts
              ACCEPTED ANSWER

              Re: Best way to call database from coach view

              ‏2012-12-06T18:48:19Z  in response to SystemAdmin
              Tony,
              That is more than ok. Questions like these are just as valuable and the types that we like to see. I'd rather have a solution to an easy puzzle than no solution at all to a harder puzzle.

              Neil