throw new MappingException(
"Identity type must contains sql information: " + _name);
}
}
ClassDescriptor relDesc = null;
try {
JDOClassDescriptorResolver jdoCDR;
jdoCDR = (JDOClassDescriptorResolver) classDescrResolver;
relDesc = jdoCDR.resolve(fmFields[i].getType());
} catch (ResolverException e) {
throw new MappingException("Problem resolving class descriptor for class "
+ fmFields.getClass(), e);
}
if (relDesc.hasNature(ClassDescriptorJDONature.class.getName())) {
FieldDescriptor[] relatedIds = ((ClassDescriptorImpl) relDesc).getIdentities();
relatedIdSQL = new String[relatedIds.length];
relatedIdType = new int[relatedIds.length];
relatedIdConvertTo = new TypeConvertor[relatedIds.length];
relatedIdConvertFrom = new TypeConvertor[relatedIds.length];
for (int j = 0; j < relatedIdSQL.length; j++) {
if (relatedIds[j].hasNature(FieldDescriptorJDONature.class.getName())) {
FieldDescriptorJDONature nature;
nature = new FieldDescriptorJDONature(relatedIds[j]);
String[] tempId = nature.getSQLName();
relatedIdSQL[j] = (tempId == null) ? null : tempId[0];
int[] tempType = nature.getSQLType();
relatedIdType[j] = (tempType == null) ? 0 : tempType[0];
FieldHandlerImpl fh = (FieldHandlerImpl) relatedIds[j].getHandler();
relatedIdConvertTo[j] = fh.getConvertTo();
relatedIdConvertFrom[j] = fh.getConvertFrom();
} 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[fieldMolderNumber] = new FieldMolder(ds, this, fmFields[i], manyTable, idSQL,