Exemplo n.º 1
0
  private void init3rdPassAdditionalImports() {
    if (active && !javaPackage.equals(javaPackageDao)) {
      additionalImportsEntity.add(javaPackageDao + "." + classNameDao);
    }

    for (ToOne toOne : toOneRelations) {
      Entity targetEntity = toOne.getTargetEntity();
      checkAdditionalImportsEntityTargetEntity(targetEntity);
      // For deep loading
      if (!targetEntity.getJavaPackage().equals(javaPackageDao)) {
        additionalImportsDao.add(targetEntity.getJavaPackage() + "." + targetEntity.getClassName());
      }
    }

    for (ToMany toMany : toManyRelations) {
      Entity targetEntity = toMany.getTargetEntity();
      checkAdditionalImportsEntityTargetEntity(targetEntity);
    }
  }
Exemplo n.º 2
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);
      }
    }
  }