else if (component != null)
{
oid = ((OIDGenerator)component.getInstance(uow.getInvocationContext())).generateOID(instance, this);
Object[] values = oid.getValueArray();
Index pk = primaryTable.getPrimaryKey();
int nCount = pk.getIndexColumnCount();
if (nCount != values.length)
{
throw new PersistenceException("err.persistence.oidValueCount",
new Object[]{component.getName(), Primitive.createInteger(nCount),
Primitive.createInteger(values.length)});
}
for (int i = 0; i < nCount; ++i)
{
values[i] = pk.getIndexColumn(i).getColumn().getValueType().convert(values[i]);
}
instance.setOID(oid);
primaryWork.setOID();
}
else
{
Metaclass metaclass = instance.getMetaclass();
for (int i = 0, n = 0, nCount = metaclass.getInstanceAttributeCount(); i < nCount; ++i)
{
Attribute attribute = metaclass.getInstanceAttribute(i);
AttributeMapping mapping = relMapping.getAttributeMapping(attribute);
int nPrimaryColCount = primaryTable.getPrimaryKey().getIndexColumnCount();
if (mapping instanceof RelationalPrimitiveMapping)
{
Column column = ((RelationalPrimitiveMapping)mapping).getColumn();
if (column.isPrimary())
{
primaryWork.setValue(column, column.getValueType().convert(instance.getValue(i)));
if (++n >= nPrimaryColCount)
{
break;
}
}
}
else if (mapping instanceof RelationalClassMapping)
{
Index index = ((RelationalClassMapping)mapping).getSourceKey();
if (index.isObjectKeyPart())
{
Object value = instance.getValue(i);
if (value instanceof OIDHolder)
{
oid = ((OIDHolder)value).getOID();
if (oid != null )
{
int nIndexColCount = index.getIndexColumnCount();
if (nIndexColCount == oid.getCount())
{
for (int k = 0; k < nIndexColCount; ++k)
{
Column column = index.getIndexColumn(k).getColumn();
if (column.isPrimary())
{
primaryWork.setValue(column, column.getValueType().convert(oid.getValue(k)));