<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    TaskSummary.getName() returns null while using persistence
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/devinderpal">Devinder Singh</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/730629#730629">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p>&#160; I'm using persistence for using jBPM 5.2 with Jboss 7. Server startups properly and jBPM also loads up properly. I'm able to start the processes using jBPM APIs. In my BPMN file, I have usertasks defined and once process is started, process stops at userTask for taking in feedback of the user, which is the expected flow.</p><p>But now I want to show to user various human tasks that he's the owner of and also wants to display the name of the task that's currently assigned to him. So I'm getting TaskSummary by using below code:</p><p class="p1" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span style="font-family: 'courier new', courier;">BlockingTaskSummaryResponseHandler responseHandler = <span class="s1">new</span> BlockingTaskSummaryResponseHandler();</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<span class="s2">taskClient</span>.getTasksAssignedAsPotentialOwner(userId, <span class="s2">"en-uk"</span>, responseHandler);</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;List&lt;TaskSummary&gt; taskSummaries = responseHandler.getResults();</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>It successfully returns the TaskSummary List but when I do getName or getDescription on TaskSummary instance, it returns null.</p><p>Then I looked at named queries defined in Task-orm.xml. Seems like it's getting name and description from I18NText table, which is empty in my database. That looks like a problem.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Can someone please help with this? How can I make TaskSummary.getName() return right values. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I''m using below code to instantiate StatefulKnowledgeSession:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span style="font-family: 'courier new', courier;">KnowledgeBase kbase = readKnowledgeBase(); // read knowledgebase from a private method</span></p><p class="p2">&#160; </p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;Environment env = KnowledgeBaseFactory.newEnvironment();</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;env.set( EnvironmentName.<span class="s1">ENTITY_MANAGER_FACTORY</span>, <span class="s1">emf</span>);</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;env.set( EnvironmentName.<span class="s1">TRANSACTION_MANAGER</span>,</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;/* setting my transaction manager*/ );</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;env.set(EnvironmentName.<span class="s1">GLOBALS</span>, <span class="s2">new</span> MapGlobalResolver());</span></p><p class="p2">&#160; </p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;Integer ksessionId = retrieveKnowledgeSessionId(); //retrieves knowledge session id from DB</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<span class="s2">if</span> (ksessionId == <span class="s2">null</span>)</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;{</span></p><p class="p3"><span style="font-family: 'courier new', courier;"><span class="s3">&#160; </span>// create a new knowledge session that uses JPA to store the runtime state</span></p><p class="p4"><span style="font-family: 'courier new', courier;"><span class="s3">&#160; </span>ksession<span class="s3"> =</span></span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; JPAKnowledgeService.newStatefulKnowledgeSession( kbase, <span class="s2">null</span>, env );</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;}</span></p><p class="p5"><span style="font-family: 'courier new', courier;"><span class="s3">&#160; </span>else</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;{</span></p><p class="p4"><span style="font-family: 'courier new', courier;"><span class="s3">&#160; </span>ksession<span class="s3"> =</span></span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;JPAKnowledgeService.loadStatefulKnowledgeSession(ksessionId, kbase, <span class="s2">null</span>, env);</span></p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;}</span></p><p class="p2" style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p class="p1"><span style="font-family: 'courier new', courier;">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<span class="s1">jbpmLogger</span> = <span class="s2">new</span> JPAWorkingMemoryDbLogger(<span class="s1">ksession</span>);</span></p><p class="p2">&#160; </p><p class="p1">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;CommandBasedWSHumanTaskHandler humanTaskHandler = </p><p class="p1">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<span class="s2">new</span> CommandBasedWSHumanTaskHandler(<span class="s1">ksession</span>);</p><p class="p1">&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;<span class="s1">ksession</span>.getWorkItemManager().registerWorkItemHandler(<span class="s4">"Human Task"</span>, humanTaskHandler);</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/730629#730629">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>