Possible bug and correction

Jul 26, 2007 at 4:14 PM
Hello again and thank you for your answer.

We are working in Oracle 10 and here is a possible bug in your code:

TypeStorage(TableName = "PILOT_BASE")
public abstract class PilotBase : Entity
TypeStorage(TableName = "PILOT", Inheritance = EntityInheritance.OneTablePerConcreteType)
public class Pilot : PilotBase
TypeStorage(TableName = "PILOT_EMPLOYEE")
public class Employee : Pilot
ChildStorage(ChildType = typeof(EmployeeAddress))
ForeignKey(ParentFieldName = "Id", ChildFieldName = "EmployeeId")
public ChildCollection EmployeeAddresses;
TypeStorage(TableName = "PILOT_EMPLOYEE_ADDRESS")
public class EmployeeAddress : Pilot
private Guid EmployeeId = Guid.Empty;
... and in the application:
Criteria crit = new Retina.Expression(employeeType);
EntitySet list = this.broker.RetrieveMatches(crit);
and the correction: in BaseEntityPersister:
protected virtual IDbCommand GetChildCollectionCommand(IDataStore dataStore,
ChildCollectionDefn childCollectionDefn, Entity parentEntity)
foreach (FieldDefn column in entityDef.LoadedColumns)
sqlBuilder.Append(", ");
//here is the modification:
//sqlBuilder.Append(dataStore.GetQualifiedName(EntityDefnCache.Get(column.DeclaringType).TableName, column.ColumnName));
sqlBuilder.Append(dataStore.GetQualifiedName(EntityDefnCache.Get(column.EntityType).TableName, column.ColumnName));

Thank you,

Jul 15, 2008 at 3:36 PM

The existing code seems to be Ok.
Your modification would only work with inherited entities that store all columns (even those inherited) in the child entity storage table.
If one of those columns exists only in a parent entity, then the column must be qualified with the parent table name.

Thanks for your time.