Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2242

Hard coded column size in CAST(? AS VARCHAR(254)) for DB2 caused runtime failure

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.1, 2.1.2, 2.2.1, 2.3.0
    • Fix Version/s: None
    • Component/s: sql
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      When procedure call is used in criteria builder as described in the following code snippet,
      a hard coded column size in CAST(? AS VARCHAR(#)) for DB2 is generated and caused run-time failure with a SQLCODE=-302, SQLSTATE=22001

      CriteriaBuilder cb = em.getCriteriaBuilder();
      CriteriaQuery<SimpleEntity> criteriaQuery = cb.createQuery(SimpleEntity.class);
      Root<SimpleEntity> simpleEntity = criteriaQuery.from(SimpleEntity.class);

      Expression<String> func1 = null;
      Expression<Double> func2 = null;
      func2 = cb.function(
      "st_point",
      Double.class,
      cb.literal("abcd......"), // error if String.length > 254
      cb.literal(1003));
      }

        Attachments

        1. OPENJPA-2242.patch
          2 kB
          Albert Lee

          Activity

            People

            • Assignee:
              allee8285 Albert Lee
              Reporter:
              allee8285 Albert Lee
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: