OpenJPA
  1. OpenJPA
  2. OPENJPA-1133

DBDictionary.getPlaceholderValueString returns 0 for boolean which fails in PostgreSQL database.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 1.1.1, 2.0.0-M3
    • Component/s: query
    • Labels:
      None
    • Environment:
      openJPA trunk.
      PostgreSQL 8.3
    • Patch Info:
      Patch Available

      Description

      When DBDictionary.getPlaceholderValueString is called with Types.BIT, it returns "0".
      PostgreSQL actually requires that a boolean be set. It cannot handle a numeric argument.

      Fix Description:
      Overriden DBDictionary.getPlaceholderValueString() inside PostgresDictionary to process Types.BIT correctly.
      Now, the method returns 'false' value when Types.BIT is passed as Column.type.

      Test case:
      The above bug is exposed from Kodo product which internally uses openJPA.
      When a query is made on a subclass using kodo api.
      Kodo generates an SQL ( with help of openJPA) that has UNION in it.

      It generates a SQL similar to the following:

      SELECT 0 FROM public.classA t0 UNION ALL SELECT t0.guidance FROM public.classB t0

      It got 0 from the openJPA DBDictionary.getPlaceholderValueString as the guidance data type is boolean.

      The above SQL will throw an exception in postgreSQL db saying:
      ERROR: UNION types integer and boolean cannot be matched.

        Activity

        Hide
        David Ezzio added a comment -

        From trunk, merged fix to 1.1.x branch at revs 802213 and 802214

        Show
        David Ezzio added a comment - From trunk, merged fix to 1.1.x branch at revs 802213 and 802214
        Hide
        Michael Dick added a comment -

        Thanks for the patch Ravi.

        Show
        Michael Dick added a comment - Thanks for the patch Ravi.
        Hide
        Ravi P Palacherla added a comment -

        Hi,

        Can someone please commit these changes.

        Thanks,
        Ravi.

        Show
        Ravi P Palacherla added a comment - Hi, Can someone please commit these changes. Thanks, Ravi.
        Hide
        Ravi P Palacherla added a comment -

        Attached patch contains test case and fix on trunk.

        Show
        Ravi P Palacherla added a comment - Attached patch contains test case and fix on trunk.

          People

          • Assignee:
            Ravi P Palacherla
            Reporter:
            Ravi P Palacherla
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development