OpenJPA
  1. OpenJPA
  2. OPENJPA-683

DiscriminatorType.CHAR doesn't work under Sybase - char defaults to CHAR(255) instead of CHAR(1) under Sybase (and other databases??)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.1.1
    • Component/s: sql
    • Labels:
      None

      Description

      Hello,

      @DiscriminatorColumn(discriminatorType=DiscriminatorType.CHAR) doesn't work under Sybase, it creates a numeric / integer column.

      This is because of the default "storeCharsAsNumbers = true" in the DBDictionary (what's that good for? why would you want to store-char-as-numbers ??).

      Setting storeCharsAsNumbers = false is still not enough, as that will lead to a CHAR(255). You also need to add "fixedSizeTypeNameSet.addAll(Arrays.asList(new String[]

      { "CHAR" }));" to a custom DBDictionary. (Wouldn't it make sense to have CHAR in fixedSizeTypeNameSet by default for all DBDictionaries?)

      I'm assuming all of the same also applies to Java Entity attributes of Type char, not just DiscriminatorType.CHAR (but haven't further looked into this).

      PS: With a custom DBDictionary with { storeCharsAsNumbers = false; fixedSizeTypeNameSet.addAll(Arrays.asList(new String[]{ "CHAR" }

      )); } in the constructor this does work; so I have a work-around for this, just posting this for the benefit of other OpenJPA/Sybase users.

      Regards,
      Michael Vorburger

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Vorburger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development