Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1967

Deprecate SQLTemplate parameter batches

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.M2
    • None
    • None

    Description

      One of the hurdles in creating a cleaner API for SQLTemplate is its support for parameter batches:

      SQLTemplate template = ...

      Map<String, Object>[] params = new Map<>[2];
      params[0] = ..
      params[1] = ..

      sqlTemplate.setParams(params);

      There's a very small performance benefit to using batches, as PreparedStatement is not precompiled between the batch bindings. So switching this form instance to QueryChain is not going to have much effect on speed, but makes things cleaner:

      SQLTemplate template = ...;
      Query[] queries = new Query[2];
      queries[0] = template.queryQueryWithParameters(..);
      queries[1] = template.queryQueryWithParameters(..);

      QueryChain chain = new QueryChain(queries);

      So going to deprecate parameter batches.

      Attachments

        Issue Links

          Activity

            People

              andrus Andrus Adamchik
              andrus Andrus Adamchik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: