addCollection(targetType);
}
private void addCollection(AmberType targetType)
{
ElementCollectionField eltCollectionField;
eltCollectionField
= new ElementCollectionField(_sourceType, _fieldName);
eltCollectionField.setType(targetType);
eltCollectionField.setLazy(isFetchLazy());
CollectionTableConfig collectionTableConfig = _collectionTable;
AmberPersistenceUnit persistenceUnit = _sourceType.getPersistenceUnit();
String sqlTable = collectionTableConfig.getName();
AmberTable mapTable = persistenceUnit.createTable(sqlTable);
HashMap<String, JoinColumnConfig> joinColumnsConfig
= collectionTableConfig.getJoinColumnMap();
ArrayList<ForeignColumn> sourceColumns = null;
sourceColumns
= calculateColumns(_field, _fieldName, mapTable,
_sourceType.getTable().getName() + "_",
_sourceType,
joinColumnsConfig);
eltCollectionField.setAssociationTable(mapTable);
eltCollectionField.setTable(sqlTable);
eltCollectionField.setSourceLink(new LinkColumns(mapTable,
_sourceType.getTable(),
sourceColumns));
_sourceType.addField(eltCollectionField);
}