}
}
relatedIdSQL = null;
String relatedType = fmFields[i].getType();
ClassDescriptor relDesc = loader.getDescriptor( ds.resolve( relatedType ) );
if ( relDesc instanceof JDOClassDescriptor ) {
FieldDescriptor[] relatedIds = ((JDOClassDescriptor)relDesc).getIdentities();
relatedIdSQL = new String[relatedIds.length];
relatedIdType = new int[relatedIds.length];
relatedIdConvertTo = new TypeConvertor[relatedIds.length];
relatedIdConvertFrom = new TypeConvertor[relatedIds.length];
relatedIdConvertParam = new String[relatedIds.length];
for ( int j=0; j < relatedIdSQL.length; j++ ) {
if ( relatedIds[j] instanceof JDOFieldDescriptor ) {
String[] tempId = ((JDOFieldDescriptor)relatedIds[j]).getSQLName();
relatedIdSQL[j] = tempId==null? null: tempId[0];
int[] tempType = ((JDOFieldDescriptor)relatedIds[j]).getSQLType();
relatedIdType[j] = tempType==null? 0: tempType[0];
FieldHandlerImpl fh = (FieldHandlerImpl)relatedIds[j].getHandler();
relatedIdConvertTo[j] = fh.getConvertTo();
relatedIdConvertFrom[j] = fh.getConvertFrom();
relatedIdConvertParam[j] = fh.getConvertParam();
} else {
throw new MappingException("Field type is not persistence-capable: "+ relatedIds[j].getFieldName() );
}
}
}
// if many-key exist, idSQL is overridden
String[] manyKey = fmFields[i].getSql().getManyKey();
if ( manyKey != null && manyKey.length != 0 ) {
if ( manyKey.length != idSQL.length )
throw new MappingException("The number of many-keys doesn't match referred object: "+clsDesc.getJavaClass().getName());
idSQL = manyKey;
}
// if name="" exist, relatedIdSQL is overridden
String[] manyName = fmFields[i].getSql().getName();
if ( manyName != null && manyName.length != 0 ) {
if ( manyName.length != relatedIdSQL.length )
throw new MappingException("The number of many-keys doesn't match referred object: "+relDesc.getJavaClass().getName());
relatedIdSQL = manyName;
}
_fhs[i] = new FieldMolder( ds, this, fmFields[i], manyTable,
idSQL, idType, idConvertTo, idConvertFrom, idConvertParam,