*/
@Override
protected void endFieldMapping(FieldMetaData field)
throws SAXException {
// setup columns with cached lob and temporal info
FieldMapping fm = (FieldMapping) field;
if (_lob || _temporal != null) {
int typeCode = fm.isElementCollection() ? fm.getElement().getDeclaredTypeCode() :
fm.getDeclaredTypeCode();
Class<?> type = fm.isElementCollection() ? fm.getElement().getDeclaredType() : fm.getDeclaredType();
if (_cols == null) {
_cols = new ArrayList<Column>(1);
_cols.add(new Column());
}
for (Column col : _cols) {
if (_lob && (typeCode == JavaTypes.STRING
|| type == char[].class
|| type == Character[].class)) {
col.setSize(-1);
col.setType(Types.CLOB);
} else if (_lob)
col.setType(Types.BLOB);
else {
switch (_temporal) {
case DATE:
col.setType(Types.DATE);
break;
case TIME:
col.setType(Types.TIME);
break;
case TIMESTAMP:
col.setType(Types.TIMESTAMP);
break;
}
}
}
}
if (_cols != null) {
switch (fm.getDeclaredTypeCode()) {
case JavaTypes.ARRAY:
Class<?> type = fm.getDeclaredType();
if (type == byte[].class || type == Byte[].class
|| type == char[].class || type == Character[].class ) {
fm.getValueInfo().setColumns(_cols);
break;
}
// else no break
case JavaTypes.COLLECTION:
if (!fm.getValue().isSerialized()) {
fm.getElementMapping().getValueInfo().setColumns(_cols);
} else {
fm.getValueInfo().setColumns(_cols);
}
break;
case JavaTypes.MAP:
fm.getElementMapping().getValueInfo().setColumns(_cols);
break;
default:
fm.getValueInfo().setColumns(_cols);
}
if (_colTable != null)
fm.getMappingInfo().setTableIdentifier(DBIdentifier.newTable(_colTable, delimit()));
setUnique(fm);
}
clearColumnInfo();
}