// Verify if a duplicate column is valid. A duplicate column name is (currently) valid when :-
// 1. subclasses defining the duplicated column are using "super class table" strategy
//
// Find the MetaData for the existing column
Column existingCol = (Column) columnsByName.get(name);
MetaData md = existingCol.getColumnMetaData().getParent();
while (!(md instanceof AbstractClassMetaData))
{
if (md == null)
{
// ColumnMetaData for existing column has no parent class somehow!
throw new JPOXUserException(LOCALISER.msg("057043",
name.getIdentifier(), getDatastoreIdentifierFullyQualified(), colmd.toString()));
}
md = md.getParent();
}
// Find the MetaData for the column to be added
MetaData dupMd = colmd.getParent();
while (!(dupMd instanceof AbstractClassMetaData))
{
dupMd = dupMd.getParent();
if (dupMd == null)
{
// ColumnMetaData for required column has no parent class somehow!
throw new JPOXUserException(LOCALISER.msg("057044",
name.getIdentifier(), getDatastoreIdentifierFullyQualified(), colmd.toString()));