initialize(dba, delegate.getType());
this.datastoreContainer = datastoreContainer;
this.delegate = delegate;
DiscriminatorMetaData dismd = datastoreContainer.getDiscriminatorMetaData();
IdentifierFactory idFactory = datastoreContainer.getStoreManager().getIdentifierFactory();
DatastoreIdentifier id = null;
if (dismd.getColumnMetaData() == null)
{
// No column name so generate a default
id = idFactory.newDiscriminatorFieldIdentifier();
ColumnMetaData colmd = new ColumnMetaData();
colmd.setName(id.getIdentifierName());
dismd.setColumnMetaData(colmd);
}
else
{
// Column metadata defined
ColumnMetaData colmd = dismd.getColumnMetaData();
if (colmd.getName() == null)
{
// No name defined so create one and set it
id = idFactory.newDiscriminatorFieldIdentifier();
colmd.setName(id.getIdentifierName());
}
else
{
// Name defined so just generate identifier
id = idFactory.newDatastoreFieldIdentifier(colmd.getName());
}
}
DatastoreField column = datastoreContainer.addDatastoreField(getType(), id, this, dismd.getColumnMetaData());
datastoreContainer.getStoreManager().getMappingManager().createDatastoreMapping(delegate, column,