[
https://issues.apache.org/jira/browse/OPENJPA-2596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14575758#comment-14575758
]
Mark Struberg commented on OPENJPA-2596:
----------------------------------------
A possible solution could be to add a 2nd Colum#equalsColumn which additionally
takes the DBDictionary as parameter and if the default Types comparison doesn't
return true then we take an additional look at the real db representation.
> schema-delta generation (sqlAction=refresh) drops columns if they have an
> alternative typeName
> ----------------------------------------------------------------------------------------------
>
> Key: OPENJPA-2596
> URL: https://issues.apache.org/jira/browse/OPENJPA-2596
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 2.4.0
> Reporter: Mark Struberg
> Assignee: Mark Struberg
> Fix For: 2.4.1
>
>
> I use Oracle with the following in my persistence.xml:
> {code}
> <property name="openjpa.jdbc.Dictionary"
> value="(BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_10)"/>
> {code}
> 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...
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)