Buggy code:
public void setColumnIO ( ColumnIO io ) { } public int getJoinDirection ( ) { } public void setJoinDirection ( int join ) { } public void clear ( ) { } protected void clear ( boolean canFlags ) { } public void copy ( MappingInfo info ) { } public boolean hasSchemaComponents ( ) { } public void assertNoSchemaComponents ( MetaDataContext context , boolean die ) { } public void assertStrategy ( MetaDataContext context , Object contextStrat , Object expected , boolean die ) { } public void assertNoIndex ( MetaDataContext context , boolean die ) { } public void assertNoUnique ( MetaDataContext context , boolean die ) { } public void assertNoForeignKey ( MetaDataContext context , boolean die ) { } public void assertNoJoin ( MetaDataContext context , boolean die ) { } public Table createTable ( MetaDataContext context , MappingInfo . TableDefaults def , String schemaName , String given , boolean adapt ) { } protected Column [ ] createColumns ( MetaDataContext context , String prefix , Column [ ] tmplates , Table table , boolean adapt ) { } boolean canMerge ( List given , Column [ ] templates , boolean adapt , boolean fill ) { } private void setIOFromColumnFlags ( Column col , int i ) { } private static void assertTable ( MetaDataContext context , Table table ) { } protected static Column mergeColumn ( MetaDataContext context , String prefix , Column tmplate , boolean compat , Column given , Table table , boolean adapt , boolean fill ) { MappingInfo . assertTable ( context , table ) ; String colName = ( given == null ) ? null : given . getName ( ) ; if ( ( ( colName == null ) && ( ! adapt ) ) && ( ! fill ) ) throw new org . apache . openjpa . util . MetaDataException ( MappingInfo . _loc . get ( ( prefix + "-no-col-name" ) , context ) ) ; MappingRepository repos = ( ( MappingRepository ) ( context . getRepository ( ) ) ) ; DBDictionary dict = repos . getDBDictionary ( ) ; if ( colName == null ) colName = tmplate . getName ( ) ; int dotIdx = colName . lastIndexOf ( dict . catalogSeparator ) ; if ( dotIdx == 0 ) colName = colName . substring ( 1 ) ; else if ( dotIdx != ( - 1 ) ) { MappingInfo . findTable ( context , colName . substring ( 0 , dotIdx ) , table , null , null ) ; colName = colName . substring ( ( dotIdx + 1 ) ) ; } Column col = table . getColumn ( colName ) ; if ( ( col == null ) && ( ! adapt ) ) { if ( ( ( colName . length ( ) ) > ( dict . maxColumnNameLength ) ) || ( ( dict . getInvalidColumnWordSet ( ) . contains ( colName . toUpperCase ( ) ) ) && ( ! ( table . getClass ( ) . getName ( ) . contains ( "DynamicTable" ) ) ) ) ) { colName = dict . getValidColumnName ( colName , new Table ( ) ) ; col = table . getColumn ( colName ) ; if ( ( col == null ) && ( ! adapt ) ) { throw new org . apache . openjpa . util . MetaDataException ( MappingInfo . _loc . get ( ( prefix + "-bad-col-name" ) , context , colName , table ) ) ; } } else { throw new org . apache . openjpa . util . MetaDataException ( MappingInfo . _loc . get ( ( prefix + "-bad-col-name" ) , context , colName , table ) ) ; } } int type = tmplate . getType ( ) ; int size = tmplate . getSize ( ) ; if ( type == ( Types . OTHER ) ) { int precis = 0 ; int scale = 0 ; if ( given != null ) { precis = given . getSize ( ) ; scale = given . getDecimalDigits ( ) ; } <START_BUG> type = dict . getJDBCType ( tmplate . getJavaType ( ) , ( size == ( - 1 ) ) , precis , scale ) ; <END_BUG> } boolean ttype = true ; int otype = type ; String typeName = tmplate . getTypeName ( ) ; Boolean notNull = null ; if ( tmplate . isNotNullExplicit ( ) ) notNull = ( tmplate . isNotNull ( ) ) ? Boolean . TRUE : Boolean . FALSE ; int decimals = tmplate . getDecimalDigits ( ) ; String defStr = tmplate . getDefaultString ( ) ; boolean autoAssign = tmplate . isAutoAssigned ( ) ; boolean relationId = tmplate . isRelationId ( ) ; boolean implicitRelation = tmplate . isImplicitRelation ( ) ; String targetField = tmplate . getTargetField ( ) ; if ( given != null ) { if ( ( given . getType ( ) ) != ( Types . OTHER ) ) { ttype = false ; if ( compat && ( ! ( given . isCompatible ( type , typeName , size , decimals ) ) ) ) { Log log = repos . getLog ( ) ; if ( log . isWarnEnabled ( ) ) log . warn ( MappingInfo . _loc . get ( ( prefix + "-incompat-col" ) , context , colName , Schemas . getJDBCName ( type ) ) ) ; } otype = given . getType ( ) ; type = dict . getPreferredType ( otype ) ; } typeName = given . getTypeName ( ) ; size = given . getSize ( ) ; decimals = given . getDecimalDigits ( ) ; if ( given . isNotNullExplicit ( ) ) notNull = ( given . isNotNull ( ) ) ? Boolean . TRUE : Boolean . FALSE ;

Fix:
type = dict . getJDBCType ( tmplate . getJavaType ( ) , ( size == ( - 1 ) ) , precis , scale , tmplate . isXML ( ) ) ;