for (int index = getObjectBuilder().getPrimaryKeyMappings().size() - 1; index >= 0; index--) {
DatabaseMapping mapping = (DatabaseMapping) getObjectBuilder().getPrimaryKeyMappings().get(index);
if ((mapping != null) && mapping.isDirectToFieldMapping()) {
getMappings().remove(mapping);
getMappings().add(0, mapping);
DatabaseField field = ((AbstractDirectMapping) mapping).getField();
getFields().remove(field);
getFields().add(0, field);
getAllFields().remove(field);
getAllFields().add(0, field);
}