mirror of https://github.com/apache/openjpa.git
OPENJPA-2865 add compat check for WITH_TIMEZONE cols
This commit is contained in:
parent
c780084ccd
commit
8e18fdbbbc
|
@ -770,8 +770,8 @@ public abstract class MappingInfo implements Serializable {
|
|||
if (col == null) {
|
||||
col = table.addColumn(colName);
|
||||
col.setType(type);
|
||||
} else if ((compat || !ttype) && !col.isCompatible(type, typeName,
|
||||
size, decimals)) {
|
||||
} else if ((compat || !ttype) &&
|
||||
!col.isCompatible(type, typeName, size, decimals)) {
|
||||
// if existing column isn't compatible with desired type, die if
|
||||
// can't adapt, else warn and change the existing column type
|
||||
Message msg = _loc.get(prefix + "-bad-col", context,
|
||||
|
|
|
@ -762,10 +762,29 @@ public class Column extends ReferenceCounter {
|
|||
case Types.DATE:
|
||||
case Types.TIME:
|
||||
case Types.TIMESTAMP:
|
||||
case Types.TIMESTAMP_WITH_TIMEZONE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case Types.TIMESTAMP_WITH_TIMEZONE:
|
||||
switch (type) {
|
||||
case Types.DATE:
|
||||
case Types.TIMESTAMP:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
case Types.TIME_WITH_TIMEZONE:
|
||||
switch (type) {
|
||||
case Types.DATE:
|
||||
case Types.TIME:
|
||||
case Types.TIMESTAMP:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
case Types.SQLXML: // All XML Types
|
||||
case 2007: // Oracle-defined opaque type code for XMLType treated the same way
|
||||
switch (type) {
|
||||
|
|
|
@ -240,8 +240,7 @@ public class DynamicSchemaFactory
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompatible(int type, String typeName, int size,
|
||||
int decimals) {
|
||||
public boolean isCompatible(int type, String typeName, int size, int decimals) {
|
||||
if (getType() != Types.OTHER)
|
||||
return super.isCompatible(type, typeName, size, decimals);
|
||||
|
||||
|
|
Loading…
Reference in New Issue