public void createMiddleClass() throws DBException {
ModelClassBase referenceModelClass = getReferenceClass();
ModelClassBase middleModelClass = getMiddleClass();
ManyReferenceField referenceField = getReverseField();
if (middleModelClass == null) {
middleModelClass = new DynamicModelClass(getMiddleModelName(), middleBaseClass, map("table", getMiddleModelTableName()));
middleModelClass.getManager().addField(
referenceField.getMiddleModelFieldName(),
new ReferenceField(referenceModelClass.getManager().getModel(), map(
"referenceModelName", referenceModelClass.getName(),
"referenceModelKeyName", referenceField.getKeyFieldName(),