while (rs.next())
{
int currentLevel = fromStack.getSize() - 1;
// create a new entry in the to-tables
ObjectStack nuStack = new ObjectStack(adapter, subClass.getRepresentedClass());
nuStack.saveNoCache(cw, lowestCommonSubClassLevel + 1);
// get the to-id of the highest non-common subclass
long nuId = nuStack.getRepresentation(lowestCommonSubClassLevel + 1).getId();
// cast the id to the correct level
Long fromId = rs.getLong(Defaults.ID_COL);
long oldId = getCastIdDatabase(fromStack, lowestCommonSubClassLevel + 1, subClass, fromId, cw);