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

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.1, 2.1.2, 2.2.1, 2.3.0
    • None
    • sql
    • None
    • 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

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

            Dates

              Created:
              Updated: