if (assoc != null && !(assoc instanceof Pair))
{
assoc = new Pair(assoc);
}
Instance parentInstance = resultList.getInstance(0);
Metaclass parentMetaclass = parentInstance.getMetaclass();
// Check for attributes without persistence mappings
if (i == 0)
{
Metaclass containerMetaclass = parentMetaclass;
for (Pair pair = (Pair)assoc; pair != null; pair = pair.getNext())
{
Attribute attribute = containerMetaclass.findAttribute((Symbol)pair.getHead());
if (attribute == null)
{
break;
}
attribute.checkReadAccess(m_context.getPrivilegeSet());
if (!attribute.isPersistent() &&
!attribute.getType().isPrimitive() &&
event == null &&
((Metaclass)attribute.getType()).findEvent("read", 6)
.findAction("main").getDeclarator().getBase() == null)
{
if (parentList.size() > 1)
{
throw new InvalidQueryException("err.persistence.multipleParentsWithoutPersistence",
new Object[]{classSym, assoc, parentMetaclass.getName()});
}
if (where != null || bookmark != null || orderBy != null)
{
throw new InvalidQueryException("err.persistence.whereWithoutPersistence",
new Object[]{classSym, assoc, parentMetaclass.getName()});
}
resultList = new InstanceArrayList();
collectAssociatedInstances((Pair)assoc, parentInstance, resultList);
int nOffset = (offset == null) ? 0 : offset.intValue();
int nCount = (count == null) ? -1 : count.intValue();
if (nOffset < 0)
{
nOffset = 0;
}
if (nCount < 0 || nCount > resultList.size() - nOffset)
{
nCount = resultList.size() - nOffset;
if (nCount < 0)
{
nCount = 0;
}
}
if (nOffset > 0 || resultList.size() > nCount)
{
InstanceList list = new InstanceArrayList(nCount);
for (int k = 0; k < nCount; ++k)
{
list.add(resultList.getInstance(k + nOffset), InstanceList.REPLACE | InstanceList.DIRECT);
}
resultList = list;
}
if (next != null && !next.booleanValue())
{
resultList.reverse();
}
for (int k = 0; k < nCount; ++k)
{
resultList.getInstance(k).invoke("load", attributes);
}
reader.setValue("results", resultList);
return resultList;
}
if (attribute.getType().isPrimitive())
{
break;
}
containerMetaclass = (Metaclass)attribute.getType();
}
}
assoc = new Pair(Symbol.ATAT, new Pair(parentMetaclass.getSymbol(), assoc));
Pair cond = Pair.binary(Symbol.EQ, assoc, parentInstance.getOID());
if (bConj)
{
where = new Pair(cond, where);
}