Uploaded image for project: '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??)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.1.0
    • 1.2.0
    • sql
    • 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

      Attachments

        Activity

          People

            Unassigned Unassigned
            vorburger Michael Vorburger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: