Package com.avaje.ebeaninternal.server.deploy

Examples of com.avaje.ebeaninternal.server.deploy.TableJoin


    if (p.isManyToMany()) {
      if (p.getMappedBy() != null) {
        // only create on other 'owning' side

      } else {
        TableJoin intersectionTableJoin = p.getIntersectionTableJoin();

        // check if the intersection table has already been created
        String intTable = intersectionTableJoin.getTable();
        if (ctx.isProcessIntersectionTable(intTable)) {
          // build the create table and fkey constraints
          // putting the DDL into ctx for later output as we are
          // in the middle of rendering the create table DDL
          new CreateIntersectionTable(ctx, p).build();
View Full Code Here


      // alter table {basetable} add foreign key (...) references {} (...) on delete restrict on update restrict;
      // Alter table o_address add Foreign Key (country_code) references o_country (code) on delete  restrict on update  restrict;

      String baseTable = p.getBeanDescriptor().getBaseTable();

      TableJoin tableJoin = p.getTableJoin();

      TableJoinColumn[] columns = tableJoin.columns();


      String tableName = p.getBeanDescriptor().getBaseTable();
      String fkName = ctx.getDdlSyntax().getForeignKeyName(tableName, p.getName(), ctx.incrementFkCount());
 
      ctx.write("alter table ").write(baseTable).write(" add ");
      if (fkName != null) {
        ctx.write("constraint ").write(fkName).write(" ");
      }
      ctx.write("foreign key (");
      for (int i = 0; i < columns.length; i++) {
        if (i > 0){
          ctx.write(",");
        }
        ctx.write(columns[i].getLocalDbColumn());
      }
      ctx.write(")");

      ctx.write(" references ");
      ctx.write(tableJoin.getTable());
      ctx.write(" (");
      for (int i = 0; i < columns.length; i++) {
        if (i > 0){
          ctx.write(",");
        }
View Full Code Here

  private void appendSelectTableJoins(DbSqlContext ctx) {

    String baseAlias = ctx.getTableAlias(prefix);

    for (int i = 0; i < tableJoins.length; i++) {
      TableJoin join = tableJoins[i];

      String alias = baseAlias + i;

      ctx.pushSecondaryTableAlias(alias);
      join.appendSelect(ctx, false);
      ctx.popTableAlias();
    }
  }
View Full Code Here

        String alias = ctx.getTableAlias(prefix);
        String[] split = SplitName.split(prefix);
        String parentAlias = ctx.getTableAlias(split[0]);
        String alias2 = alias + "z_";

        TableJoin manyToManyJoin = manyProp.getIntersectionTableJoin();
        manyToManyJoin.addJoin(joinType, parentAlias, alias2, ctx);

        return nodeBeanProp.addJoin(joinType, alias2, alias, ctx);
      }

    }
View Full Code Here

        String alias = ctx.getTableAlias(prefix);
        String[] split = SplitName.split(prefix);
        String parentAlias = ctx.getTableAlias(split[0]);
        String alias2 = alias+"z_";
       
        TableJoin manyToManyJoin = manyProp.getIntersectionTableJoin();
        manyToManyJoin.addJoin(joinType, parentAlias, alias2, ctx);
       
        assocBeanProperty.addJoin(joinType, alias2, alias, ctx);
      }
    }
       
View Full Code Here

    }
   
    List<DeployTableJoin> deployTableJoins = deploy.getTableJoins();
    tableJoins = new TableJoin[deployTableJoins.size()];
    for (int i = 0; i < deployTableJoins.size(); i++) {
      tableJoins[i] = new TableJoin(deployTableJoins.get(i), propertyMap);
    }

  }
View Full Code Here

  /**
   * Create the immutable version of the intersection join.
   */
  public TableJoin createIntersectionTableJoin() {
    if (intersectionJoin != null){
      return new TableJoin(intersectionJoin, null);
    } else {
      return null;
    }
  }
View Full Code Here

  /**
   * Create the immutable version of the inverse join.
   */
  public TableJoin createInverseTableJoin() {
    if (inverseJoin != null){
      return new TableJoin(inverseJoin, null);
    } else {
      return null;
    }
  }
View Full Code Here

                manyProp.addJoin(joinType, parentAlias, alias, ctx);
   
            } else {
                String alias2 = alias + "z_";
   
                TableJoin manyToManyJoin = manyProp.getIntersectionTableJoin();
                manyToManyJoin.addJoin(joinType, parentAlias, alias2, ctx);
                manyProp.addJoin(joinType, alias2, alias, ctx);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.deploy.TableJoin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.