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

schema-delta generation (sqlAction=refresh) drops columns if they have an alternative typeName

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4.0
    • 2.4.1
    • jdbc
    • None

    Description

      I use Oracle with the following in my persistence.xml:

      <property name="openjpa.jdbc.Dictionary" value="(BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_10)"/>
      

      It is all about the *TypeName. The BooleanRepresentation has no impact. I just added it to show the full use case.

      The problem is that during the MappingTool retain there is a Column#equalsColumn which only looks at the Type integers but not on any typeName representation in the DBDictionary.

      What now happens is that during openjpa:sql with sqlAction=build it perfectly creates a CHAR(1) for every boolean and Boolean field in my entity.
      But during a sqlAction=refresh it wrongly believes that the types it gets from the SchemaTool by parsing the real db (CHAR length1 java.sql.Types#CHAR=1) is not compatible to the type it sees in the MappingTool from parsing the Entity annotations + orm.xml (java.sql.Tpyes.BIT=-7).

      The result is that generated delta script wrongly drops the column and later adds it again with exactly the same definitions. And this happens every time...

      Attachments

        1. OPENJPA-2596.patch
          6 kB
          Mark Struberg

        Activity

          People

            struberg Mark Struberg
            struberg Mark Struberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: