Ejemplo n.º 1
0
  private void init3rdPassRelations() {
    Set<String> toOneNames = new HashSet<String>();
    for (ToOne toOne : toOneRelations) {
      toOne.init3ndPass();
      if (!toOneNames.add(toOne.getName().toLowerCase())) {
        throw new RuntimeException("Duplicate name for " + toOne);
      }
    }

    Set<String> toManyNames = new HashSet<String>();
    for (ToMany toMany : toManyRelations) {
      toMany.init3ndPass();
      Entity targetEntity = toMany.getTargetEntity();
      for (Property targetProperty : toMany.getTargetProperties()) {
        if (!targetEntity.propertiesColumns.contains(targetProperty)) {
          targetEntity.propertiesColumns.add(targetProperty);
        }
      }
      if (!toManyNames.add(toMany.getName().toLowerCase())) {
        throw new RuntimeException("Duplicate name for " + toMany);
      }
    }
  }