Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-2792

Data manipulation with HQL / SQL nodes

XMLWordPrintable

      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)

      { result = q.uniqueResult(); }

      else

      { result = q.list(); }

      }
      // ...

              rebody HuiSheng Xu (Inactive)
              h.peter Peter Horvath (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: