Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy
Thanks Kris. That's what I thought later on after your first mail on this topic. So I did got the JPA entity persisted/merged after retrieving the entitymanagerfactory from the working memory's environment and got it done through the JPA transaction - I will refactor this to use the JPA command service so that I don't have to deal with transaction et all. -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Kris Verlaenen Sent: Wednesday, November 25, 2009 10:06 AM To: Rules Users List; Vijay K Pandey Cc: Rules Users List Subject: Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy Quoting Vijay K Pandey : > > c)I would like to change it through Drools Process because that's > where I have associated the JPA entities - I would not like to update > it from outside. Not sure this is a problem. You merely create an association to these JPA entities (assuming we implement the pluggable persistence strategy here as well). And the engine is only interested in the start and completion of the work item, not really in anything that happens in between. So I don't think updating the JPA entities from outside the engine should be considered a problem. In theory you could easily update the work item, we simply don't have a command for that implemented. If you would write a command that can then be executed inside a transaction using the JPA command service, those changes would be persisted. Kris Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy
Quoting Vijay K Pandey : > > c)I would like to change it through Drools Process because that's > where I have associated the JPA entities - I would not like to update > it from outside. Not sure this is a problem. You merely create an association to these JPA entities (assuming we implement the pluggable persistence strategy here as well). And the engine is only interested in the start and completion of the work item, not really in anything that happens in between. So I don't think updating the JPA entities from outside the engine should be considered a problem. In theory you could easily update the work item, we simply don't have a command for that implemented. If you would write a command that can then be executed inside a transaction using the JPA command service, those changes would be persisted. Kris Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy
This is what we are trying to solve. a)A process has been started - then it reaches the workitem and the process waits there - and the thread ends. b)Now in a different thread after few days/or few hours - system gets some data from external application and has to update the workitem related content - we have to set it outside of the binary content of workiteminfo as we need to have a query (sql,ejb-ql)working against this set of updated data. c)I would like to change it through Drools Process because that's where I have associated the JPA entities - I would not like to update it from outside. d)After the update has been done - may be after few/hrs - the work item will be completed/aborted based on the updated data. e)So should I try with "setVariable" - as such there won't be any execution happening while updating the entity on that process instance? Any recommendation on this? Thanks Vijay -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Kris Verlaenen Sent: Monday, November 23, 2009 7:10 PM To: Rules Users List; Vijay K Pandey Subject: Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy You want to change the JPA entities themselves? Do you still have a reference to them? Simply changing them would probably work (or what is it you are trying to do)? Or you could look them up using the getVariable() method. In theory you could also use the setVariable() method but that is not in the public API as you shouldn't be changing variables in the middle of execution. Kris Quoting Vijay K Pandey : > Hi, > > In Drools Flow (5.1) , if for a work item "Wait For Completion" is > true - what is the best way of updating the variables (JPA entities) > configured through the Variable Persistence strategy - from a session > (loaded through JPAKnowledgeService) while the work item is in the > "Pending" state. These variables (JPA entities) were passed to the > "startProcess" method of the session (StatefulKnowledgeSession) when > the process was earlier started. > > Thanks > Vijay > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy
You want to change the JPA entities themselves? Do you still have a reference to them? Simply changing them would probably work (or what is it you are trying to do)? Or you could look them up using the getVariable() method. In theory you could also use the setVariable() method but that is not in the public API as you shouldn't be changing variables in the middle of execution. Kris Quoting Vijay K Pandey : > Hi, > > In Drools Flow (5.1) , if for a work item "Wait For Completion" is > true - what is the best way of updating the variables (JPA entities) > configured through the Variable Persistence strategy - from a session > (loaded through JPAKnowledgeService) while the work item is in the > "Pending" state. These variables (JPA entities) were passed to the > "startProcess" method of the session (StatefulKnowledgeSession) when > the process was earlier started. > > Thanks > Vijay > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools Flow 5.1 - Update JPA Entity - while workitem is in pending state - variable persistence strategy
Hi, In Drools Flow (5.1) , if for a work item "Wait For Completion" is true - what is the best way of updating the variables (JPA entities) configured through the Variable Persistence strategy - from a session (loaded through JPAKnowledgeService) while the work item is in the "Pending" state. These variables (JPA entities) were passed to the "startProcess" method of the session (StatefulKnowledgeSession) when the process was earlier started. Thanks Vijay ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users