// create the fields for the linktable
Field field;
Vector<String> unique = new Vector<String>();
field = new Field(mrefEntity, new XrefField(), xref_field_from.getMrefRemoteid(), null, false,
false, false, null);
field.setXRefVariables(xref_entity_to.getName(), xref_field_to.getName(),
xref_field_from.getXrefLabelNames());
if (xref_field_from.isXrefCascade()) field.setXrefCascade(true);
mrefEntity.addField(field);
unique.add(field.getName());
// add all the key-fields of xref_entity_from
for (Field key : xref_entity_from.getKeyFields(Entity.PRIMARY_KEY))
{
field = new Field(mrefEntity, new XrefField(), xref_field_from.getMrefLocalid(), null,
false, false, false, null);
// null xreflabel
field.setXRefVariables(xref_entity_from.getName(), key.getName(), null);