Examples of AmberColumn


Examples of com.caucho.amber.table.AmberColumn

          EntityType entityType = item.getEntityType();

          // jpa/0l44
          if (entityType != null) {
            AmberColumn discriminator = entityType.getDiscriminator();

            // jpa/0l43
            if (entityType instanceof SubEntityType &&
                discriminator != null) {
              // jpa/0l12, jpa/0l4b

              if (item.getTable() == discriminator.getTable()) {
                if (isFirst) {
                  isFirst = false;
                  cb.append(" where ");
                }
                else
                  cb.append(" and ");

                cb.append("(" + item.getName() + "." + discriminator.getName() + " = ");
                cb.append("'" + entityType.getDiscriminatorValue() + "')");
              }
            }
          }
        }
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

                                     boolean select)
  {
    cb.append('(');

    for (int i = 0; i < _keyColumns.size(); i++) {
      AmberColumn column = _keyColumns.get(i);

      if (i != 0)
        cb.append(" AND ");

      cb.append(_fromItemA.getName());
      cb.append('.');
      cb.append(column.getName());

      cb.append('=');

      cb.append(_fromItemB.getName());
      cb.append('.');
      cb.append(column.getName());
    }

    cb.append('(');
  }
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

      EntityType entityType = item.getEntityType();

      // jpa/0l44
      if (entityType != null) {
        AmberColumn discriminator = entityType.getDiscriminator();

        // jpa/0l43
        if (entityType instanceof SubEntityType &&
            discriminator != null) {
          // jpa/0l12, jpa/0l4b

          if (item.getTable() == discriminator.getTable()) {
            if (hasExpr)
              cb.append(" and ");
            else {
              cb.append(" where ");
              hasExpr = true;
            }

            cb.append("(" + item.getName() + "." + discriminator.getName() + " = ");
            cb.append("'" + entityType.getDiscriminatorValue() + "')");
          }
        }
      }
    }
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

    out.print("com.caucho.amber.entity.AmberEntityHome home, ");
    out.println("Object key)");
    out.println("{");
    out.pushDepth();

    AmberColumn discriminator = _entityType.getDiscriminator();

    if (_entityType.isAbstractClass()
        || _entityType.getId() == null
        || discriminator == null) {
      out.println("return __caucho_home_new(home, key, aConn, null);");
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

      String refName = joinColumn.getReferencedColumnName();

      IdField id = getField(idFields, refName);

      AmberColumn column = id.getColumns().get(0);

      foreignColumn = mapTable.createForeignColumn(name, column);

      columns.add(foreignColumn);
    }
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

    // jpa/0w24
    property.setType(amberType);

    property.setLazy(isFetchLazy());

    AmberColumn fieldColumn = createColumn(amberType);
    property.setColumn(fieldColumn);

    /*
      field.setInsertable(insertable);
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

  private AmberColumn createColumn(AmberType amberType)
    throws ConfigException
  {
    String name = _column.getName();

    AmberColumn column = null;

    if (_sourceType instanceof EntityType) {
      EntityType entityType = (EntityType) _sourceType;
     
      String tableName = _column.getTable();
      AmberTable table;

      if (tableName.equals("")) {
        table = entityType.getTable();

        if (table == null)
          throw error(_field, L.l("{0} @Column(name='{1}') is an unknown table.",
                                  _fieldName,
                                  name));
      }
      else {
        table = entityType.getSecondaryTable(tableName);

        if (table == null)
          throw error(_field, L.l("{0} @Column(table='{1}') is an unknown secondary table.",
                                  _fieldName,
                                  tableName));
      }

      column = table.createColumn(name, amberType);
    }
    else { // embeddable
      column = new AmberColumn(null, name, amberType);
    }

    // primaryKey = column.primaryKey();
    column.setUnique(_column.isUnique());
    column.setNotNull(! _column.isNullable());
    //insertable = column.insertable();
    //updateable = column.updatable();
    if (! "".equals(_column.getColumnDefinition()))
      column.setSQLType(_column.getColumnDefinition());
     
    column.setLength(_column.getLength());
    int precision = _column.getPrecision();
    if (precision < 0) {
      throw error(_field, L.l("{0} @Column precision cannot be less than 0.",
                             _fieldName));
    }

    int scale = _column.getScale();
    if (scale < 0) {
      throw error(_field, L.l("{0} @Column scale cannot be less than 0.",
                             _fieldName));
    }

    // this test implicitly works for case where
    // precision is not set explicitly (ie: set to 0 by default)
    // and scale is set
    if (precision < scale) {
      throw error(_field, L.l("{0} @Column scale cannot be greater than precision. Must set precision to a non-zero value before setting scale.",
                             _fieldName));
    }

    if (precision > 0) {
      column.setPrecision(precision);
      column.setScale(scale);
    }

    return column;
  }
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

      String refName = joinColumn.getReferencedColumnName();

      IdField id = getField(idFields, refName);

      AmberColumn column = id.getColumns().get(0);

      foreignColumn = mapTable.createForeignColumn(name, column);

      columns.add(foreignColumn);
    }
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

   * Creates the expression for the field.
   */
  @Override
  public AmberExpr createExpr(QueryParser parser, PathExpr parent)
  {
    AmberColumn column;

    if (parent instanceof EmbeddedExpr) {
      column = ((EmbeddedExpr) parent).getColumnByFieldName(getName());
    }
    else
View Full Code Here

Examples of com.caucho.amber.table.AmberColumn

        out.println("if (field" + i + " == null)");
        out.println("  return;");

        KeyPropertyField prop = null;

        AmberColumn column = key.getColumn();

        // jpa/0j55
        if (true || column == null) {
          ArrayList<IdField> fields = getKeys();
          for (int j = 0; j < fields.size(); j++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.