if (nd.isFieldName()) {
//The identifier of the class is based on a single field
PrimitiveElement pe = (PrimitiveElement) clazz.getTypedElement(nd
.getFieldName());
if (pe == null) {
throw new SpeedoException(
"impossible to map the fields of the namedef of the metaobject '"
+ JormPathHelper.getPath(clazz) + "'.");
}
SpeedoField sf = sc.getField(pe.getName());
if (sf == null) {
// The single field used as identifier is not a visible
// persistent field
if (sc.identity.columns != null
&& sc.identity.columns.length == 1
&& sc.identity.columns[0] != null
&& sc.identity.columns[0].column != null
&& sc.identity.columns[0].column.name != null) {
// the column name of the hidden identity field has been
// specified
createFieldMapping(pe,
sc.identity.columns[0].column.name,
sc.identity.columns[0].column.sqlType,
rcm.getMainRdbTable(),
null);
} else {
// No column name specified
createFieldMapping(pe, (SpeedoCommonField) null, cm);
}
}
} else {
// The identifier of the persistent class is based on several
// persistent field.
Collection c = nd.getNameRef().getProjection().values();
int i = 0;
for (Iterator it = c.iterator(); it.hasNext();) {
PrimitiveElement pe = (PrimitiveElement) clazz
.getTypedElement((String) it.next());
if (pe == null) {
throw new SpeedoException(
"impossible to map the fields of the namedef of the metaobject '"
+ JormPathHelper.getPath(clazz) + "'.");
}
//find the corresponding Speedo meta object.
SpeedoField sf = sc.getField(pe.getName());