Package com.caucho.amber.table

Examples of com.caucho.amber.table.AmberTable


    // XXX: also needs to check PersistenceContextType.TRANSACTION/EXTENDED.
    // jpa/0k10
    if (! isActiveTransaction())
      return;

    AmberTable table = entity.__caucho_getEntityType().getTable();

    Object key = entity.__caucho_getPrimaryKey();

    addCompletion(new RowInvalidateCompletion(table.getName(), key));

    // jpa/0ga8, jpa/0s2d if (! _txEntities.contains(entity)) {
    Entity oldEntity = getTransactionEntity(entity.getClass(), key);

    if (oldEntity == null) {
View Full Code Here


    // XXX: not correct, since we need to keep the P_PERSIST state around
    // and P_PERSIST is a transactional state
    // setTransactionalState(entity);

    // jpa/0g0i
    AmberTable table = home.getEntityType().getTable();
    addCompletion(new RowInsertCompletion(table.getName()));
  }
View Full Code Here

    int dirtyCount = _entityType.getDirtyIndex();
    for (int i = 0; i <= dirtyCount / 64; i++) {
      out.println("__caucho_dirtyMask_" + i + " = 0L;");
    }

    AmberTable table = _entityType.getTable();

    String sql = null;

    out.println("String sql;");
View Full Code Here

    }

    out.println("if ((__caucho_loadMask_" + group + " & " + mask + "L) != 0)");
    out.println("  return;");

    AmberTable table = _entityType.getTable();

    String from = null;
    String select = null;
    String where = null;

    String subSelect = null;
    AmberTable mainTable = null;
    String tableName = null;

    select = _entityType.generateLoadSelect(table, "o", _index);

    if (select != null) {
      from = table.getName() + " o";
      where = _entityType.getId().generateMatchArgWhere("o");
      mainTable = table;
      tableName = "o";
    }

    ArrayList<AmberTable> subTables = _entityType.getSecondaryTables();

    for (int i = 0; i < subTables.size(); i++) {
      AmberTable subTable = subTables.get(i);

      subSelect = _entityType.generateLoadSelect(subTable, "o" + i, _index);

      if (subSelect == null)
        continue;

      if (select != null)
        select = select + ", " + subSelect;
      else
        select = subSelect;

      if (from != null)
        from = from + ", " + subTable.getName() + " o" + i;
      else
        from = subTable.getName() + " o" + i;

      if (where != null) {
        LinkColumns link = subTable.getDependentIdLink();

        where = where + " and " + link.generateJoin("o" + i, "o");
      }
      else
        throw new IllegalStateException();
View Full Code Here

    AmberColumn oldColumn = field.getColumn();
    // XXX: deal with types
    AbstractField newField = (AbstractField) field.override(_entityType);

    if (column != null) {
      AmberTable table = _entityType.getTable();
      AmberColumn newColumn = table.createColumn(column.getName(),
              oldColumn.getType());

      newField.setColumn(newColumn);

      newField.init();
 
      return newField;
    }
    else {
      AmberTable table = _entityType.getTable();
      AmberColumn newColumn = table.createColumn(oldColumn.getName(),
              oldColumn.getType());

      newField.setColumn(newColumn);

      newField.init();
View Full Code Here

  public AmberTable createTable(String tableName)
  {
    if (log.isLoggable(Level.FINER))
      log.log(Level.FINER, "AmberPersistenceUnit.createTable: " + tableName);

    AmberTable table = _tableMap.get(tableName);

    if (table == null) {
      table = new AmberTable(this, tableName);
      table.setCacheTimeout(getTableCacheTimeout());

      _tableMap.put(tableName, table);

      _lazyTable.add(table);
    }
View Full Code Here

  {
    for (IdGenerator gen : _tableGenMap.values())
      gen.start();

    while (_lazyTable.size() > 0) {
      AmberTable table = _lazyTable.remove(0);

      if (getDataSource() == null)
        throw new ConfigException(L.l("{0}: No configured data-source found.",
                                      this));

      if (getCreateDatabaseTables())
        table.createDatabaseTable(this);

      if (getValidateDatabaseTables())
        table.validateDatabaseTable(this);
    }
  }
View Full Code Here

      break;
    default:
      throw new IllegalStateException();
    }

    AmberTable table = entityType.getTable();

    // jpa/0gg0
    if (table == null)
      return;

    com.caucho.amber.table.AmberColumn column
      = table.createColumn(columnName, columnType);

    if (discriminatorAnn != null) {
//      column.setNotNull(! discriminatorAnn.nullable());

      column.setLength(discriminatorAnn.length());
View Full Code Here

             EntityType parentType)
  {
    // XXX: need better test
    boolean isEntity = ! (entityType instanceof MappedSuperclassType);
   
    AmberTable table = null;

    getInternalTableConfig(type, _annotationCfg);
    Table tableAnn = (Table) _annotationCfg.getAnnotation();
    TableConfig tableConfig = _annotationCfg.getTableConfig();
View Full Code Here

  {
    getInternalSecondaryTableConfig(type, _annotationCfg);
    SecondaryTable secondaryTableAnn = (SecondaryTable) _annotationCfg.getAnnotation();
    SecondaryTableConfig secondaryTableConfig = _annotationCfg.getSecondaryTableConfig();

    AmberTable secondaryTable = null;

    if ((secondaryTableAnn != null) || (secondaryTableConfig != null)) {
      String secondaryName;

      if (secondaryTableAnn != null)
View Full Code Here

TOP

Related Classes of com.caucho.amber.table.AmberTable

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.