{
Class implType = clr.classForName(implMappings[i].getType());
if (type.isAssignableFrom(implType))
{
DatastoreClass castTable = storeMgr.getDatastoreClass(type.getName(), clr);
SQLTable castSqlTbl = stmt.leftOuterJoin(table, implMappings[i], refMapping,
castTable, null, castTable.getIdMapping(), null, null, null);
return exprFactory.newExpression(stmt, castSqlTbl, castTable.getIdMapping());
}
}
// No implementation matching this cast type, so return false
NucleusLogger.QUERY.warn("Unable to process cast of interface field to " + type.getName() +
" since it has no implementations that match that type");
JavaTypeMapping m = exprFactory.getMappingForType(boolean.class, true);
return exprFactory.newLiteral(stmt, m, false).eq(exprFactory.newLiteral(stmt, m, true));
}
else if (mapping instanceof PersistableMapping)
{
// Check if there is already the cast table in the current table group
DatastoreClass castTable = storeMgr.getDatastoreClass(type.getName(), clr);
SQLTable castSqlTbl = stmt.getTable(castTable, table.getGroupName());
if (castSqlTbl == null)
{
// Join not present, so join to the cast table
castSqlTbl = stmt.leftOuterJoin(table, table.getTable().getIdMapping(),
castTable, null, castTable.getIdMapping(), null, table.getGroupName());