Bug 895814
| Summary: | Avoid updating ProcessInstanceInfo in JPAProcessInstanceManager.getProcessInstance() | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise BRMS Platform 5 | Reporter: | Toshiya Kobayashi <tkobayas> | ||||
| Component: | jBPM 5 | Assignee: | Kris Verlaenen <kverlaen> | ||||
| Status: | CLOSED UPSTREAM | QA Contact: | Marek Baluch <mbaluch> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | BRMS 5.3.1 | ||||||
| Target Milestone: | --- | ||||||
| Target Release: | One Off Releases | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2025-02-10 03:27:17 UTC | Type: | Feature Request | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 873846 | ||||||
| Attachments: |
|
||||||
|
Description
Toshiya Kobayashi
2013-01-16 04:02:59 UTC
Created attachment 679320 [details]
jBPMEx55_getProcessInstance_SOSE_BRMS531.zip
Toshiya Kobayashi <tkobayas> made a comment on jira JBPM-3902 Attaching a reproducer. Please run ProcessMainJPA. Toshiya Kobayashi <tkobayas> made a comment on jira JBPM-3902 Adding a method like getProcessInstanceReadOnly() which doesn't update lastReadDate may be easier to implement but it would affect interfaces instead. Andrey Moiseev <andrey.moiseev> made a comment on jira JBPM-3902 Now as a workaround we are using code like this StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(...); ProcessInstanceInfo pii = emf.createEntityManager().find(ProcessInstanceInfo.class, id); ProcessInstance pi = pii.getProcessInstance(new StatefulKnowledgeSessionImpl((ReteooWorkingMemory) ((NamedEntryPoint) ksession .getWorkingMemoryEntryPoint("DEFAULT")).getInternalWorkingMemory()), ksession .getEnvironment()); Kris Verlaenen <kris.verlaenen> updated the status of jira JBPM-3902 to Resolved added method getProcessInstance(id, boolean readOnly) Included in roll-up #1: BZ-873846 Verified in roll-up patch BZ-873846 (5.3.1.BRMS-P02) using Toshiya's reproducer. Thanks! Chris Wash <chris.wash> made a comment on jira JBPM-3902 Is there a patch to backport this fix to 5.4.0 Community? Anselmo Abadía <anselmo.abadia> made a comment on jira JBPM-3902 My workaround: 1) Modify ProcessInstanceInfo persistence mapping. Make the lastReadDate's field transient. <!-- <basic name="lastReadDate" access="FIELD" > --> <!-- <temporal>TIMESTAMP</temporal> --> <!-- </basic> --> <transient name="lastReadDate"/> 2) Dirty the current process instance at the end of each waitState. E.g completeHumanTask or signalEvent E.g. kSession.execute(new DirtyProcessInstanceInfo(kSession, processInstanceId)); kSession.signalEvent(type, event, processInstanceId); public class DirtyProcessInstanceInfo implements GenericCommand<Object> { private final StatefulKnowledgeSession kSession; private final Long id; private static final long serialVersionUID = 1L; public DirtProcessInstanceInfo(StatefulKnowledgeSession kSession, long id) { this.kSession = kSession; this.id = id; } public Object execute(Context context) { EntityManager manager = (EntityManager) kSession.getEnvironment().get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER); ProcessInstanceInfo processInstanceInfo = manager.find( ProcessInstanceInfo.class, id); FieldUtils.setProtectedFieldValue("lastModificationDate", processInstanceInfo, new Date()); return null; } } 3) Pray Bye. Anselmo Abadía <anselmo.abadia> made a comment on jira JBPM-3902 My workaround: 1) Modify ProcessInstanceInfo persistence mapping. Make the lastReadDate's field transient. {code} <!-- <basic name="lastReadDate" access="FIELD" > --> <!-- <temporal>TIMESTAMP</temporal> --> <!-- </basic> --> <transient name="lastReadDate"/> {code} 2) Dirty the current process instance at the end of each waitState. E.g completeHumanTask or signalEvent E.g. {code} kSession.execute(new DirtyProcessInstanceInfo(kSession, processInstanceId)); kSession.signalEvent(type, event, processInstanceId); {code} {code} public class DirtyProcessInstanceInfo implements GenericCommand<Object> { private final StatefulKnowledgeSession kSession; private final Long id; private static final long serialVersionUID = 1L; public DirtProcessInstanceInfo(StatefulKnowledgeSession kSession, long id) { this.kSession = kSession; this.id = id; } public Object execute(Context context) { EntityManager manager = (EntityManager) kSession.getEnvironment().get( EnvironmentName.CMD_SCOPED_ENTITY_MANAGER); ProcessInstanceInfo processInstanceInfo = manager.find( ProcessInstanceInfo.class, id); FieldUtils.setProtectedFieldValue("lastModificationDate", processInstanceInfo, new Date()); return null; } } {code} 3) Pray Bye. This product has been discontinued or is no longer tracked in Red Hat Bugzilla. |