-
Feature Request
-
Resolution: Done
-
Major
-
jBPM 4.4
Currently HQL / SQL nodes only allow you to run queries. It would be great if it was possible to run data manipulation operations (INSERT / UPDATE / DELETE) as well.
It should be quite easy to implement this by adding a new possible flag to the hql / sql node and calling org.hibernate.Query.executeUpdate() from org.jbpm.jpdl.internal.activity.HqlActivity.perform(OpenExecution) method:
public class HqlActivity extends JpdlAutomaticActivity {
// ...
public void perform(OpenExecution execution) {
// ...
if(isUpdate) { // isUpdate: this a new flag that indicates that this is a data manipulation operation
// execute update and store the number of entities / rows affected (inserted, updated or deleted) by this operation into the result variable
result = q.executeUpdate();
} else { if (isResultUnique)
else
{ result = q.list(); }}
// ...