Package org.hibernate.cfg.reveng

Examples of org.hibernate.cfg.reveng.TableIdentifier


        continue;
      }

       
      RootClass rc = new RootClass();
      TableIdentifier tableIdentifier = TableIdentifier.create(table);
      String className = revengStrategy.tableToClassName( tableIdentifier );
      log.debug("Building entity " + className + " based on " + tableIdentifier);
      rc.setEntityName( className );
      rc.setClassName( className );
      rc.setProxyInterfaceName( rc.getEntityName() ); // TODO: configurable ?
View Full Code Here


  private String bindCollection(PersistentClass rc, ForeignKey fromForeignKey, ForeignKey toForeignKey, Collection collection) {
    ForeignKey targetKey = fromForeignKey;
    String collectionRole = null;
    boolean collectionLazy = false;
    boolean collectionInverse = false;
    TableIdentifier foreignKeyTable = null;
    String tableToClassName;

    if(toForeignKey!=null) {
      targetKey = toForeignKey;
    }

    boolean uniqueReference = isUniqueReference(targetKey); // TODO: need to look one step further for many-to-many!
    foreignKeyTable = TableIdentifier.create( targetKey.getTable() );
    TableIdentifier foreignKeyReferencedTable = TableIdentifier.create( targetKey.getReferencedTable() );

    if(toForeignKey==null) {

      collectionRole = revengStrategy.foreignKeyToCollectionName(
          fromForeignKey.getName(),
View Full Code Here

        Column col = (Column) iter.next();
        keyColumns.add(col);
      }
    }

    final TableIdentifier tableIdentifier = TableIdentifier.create(table);

    String tableIdentifierStrategyName = "assigned";

    boolean naturalId;

    if (keyColumns.size()>1) {
      log.debug("id strategy for " + rc.getEntityName() + " since it has a multiple column primary key");
      naturalId = true;

      id = handleCompositeKey(rc, processed, keyColumns, mapping);
      idPropertyname = revengStrategy.tableToIdentifierPropertyName(tableIdentifier);
      if(idPropertyname==null) {
        idPropertyname = "id";
      }
    }
    else {
      pki.suggestedStrategy = revengStrategy.getTableIdentifierStrategyName(tableIdentifier);
      String suggestedStrategy = pki.suggestedStrategy;
      if(suggestedStrategy==null) {
        suggestedStrategy = collector.getSuggestedIdentifierStrategy( tableIdentifier.getCatalog(), tableIdentifier.getSchema(), tableIdentifier.getName() );
        if(suggestedStrategy==null) {
          suggestedStrategy = "assigned";
        }
        tableIdentifierStrategyName = suggestedStrategy;
      } else {
View Full Code Here

      }
    }
  }

  private void bindColumnsToVersioning(Table table, RootClass rc, Set processed, Mapping mapping) {
    TableIdentifier identifier = TableIdentifier.create(table);

    String optimisticLockColumnName = revengStrategy.getOptimisticLockColumnName(identifier);

    if(optimisticLockColumnName!=null) {
      Column column = table.getColumn(new Column(optimisticLockColumnName));
View Full Code Here

        continue;
      }

       
      RootClass rc = new RootClass();
      TableIdentifier tableIdentifier = TableIdentifier.create(table);
      String className = revengStrategy.tableToClassName( tableIdentifier );
      log.debug("Building entity " + className + " based on " + tableIdentifier);
      rc.setEntityName( className );
      rc.setClassName( className );
      rc.setProxyInterfaceName( rc.getEntityName() ); // TODO: configurable ?
View Full Code Here

  private String bindCollection(PersistentClass rc, ForeignKey fromForeignKey, ForeignKey toForeignKey, Collection collection) {
    ForeignKey targetKey = fromForeignKey;
    String collectionRole = null;
    boolean collectionLazy = false;
    boolean collectionInverse = false;
    TableIdentifier foreignKeyTable = null;
    String tableToClassName;

    if(toForeignKey!=null) {
      targetKey = toForeignKey;
    }

    boolean uniqueReference = isUniqueReference(targetKey); // TODO: need to look one step further for many-to-many!
    foreignKeyTable = TableIdentifier.create( targetKey.getTable() );
    TableIdentifier foreignKeyReferencedTable = TableIdentifier.create( targetKey.getReferencedTable() );

    if(toForeignKey==null) {

      collectionRole = revengStrategy.foreignKeyToCollectionName(
          fromForeignKey.getName(),
View Full Code Here

        Column col = (Column) iter.next();
        keyColumns.add(col);
      }
    }

    final TableIdentifier tableIdentifier = TableIdentifier.create(table);

    String tableIdentifierStrategyName = "assigned";

    boolean naturalId;

    if (keyColumns.size()>1) {
      log.debug("id strategy for " + rc.getEntityName() + " since it has a multiple column primary key");
      naturalId = true;

      id = handleCompositeKey(rc, processed, keyColumns, mapping);
      idPropertyname = revengStrategy.tableToIdentifierPropertyName(tableIdentifier);
      if(idPropertyname==null) {
        idPropertyname = "id";
      }
    }
    else {
      pki.suggestedStrategy = revengStrategy.getTableIdentifierStrategyName(tableIdentifier);
      String suggestedStrategy = pki.suggestedStrategy;
      if(suggestedStrategy==null) {
        suggestedStrategy = collector.getSuggestedIdentifierStrategy( tableIdentifier.getCatalog(), tableIdentifier.getSchema(), tableIdentifier.getName() );
        if(suggestedStrategy==null) {
          suggestedStrategy = "assigned";
        }
        tableIdentifierStrategyName = suggestedStrategy;
      } else {
View Full Code Here

      }
    }
  }

  private void bindColumnsToVersioning(Table table, RootClass rc, Set processed, Mapping mapping) {
    TableIdentifier identifier = TableIdentifier.create(table);

    String optimisticLockColumnName = revengStrategy.getOptimisticLockColumnName(identifier);

    if(optimisticLockColumnName!=null) {
      Column column = table.getColumn(new Column(optimisticLockColumnName));
View Full Code Here

    if(catchild.getName().equals(TABLE2)) {
      catchild = (Table) tables.get(1);
      catmaster = (Table) tables.get(0);
    }
     
    TableIdentifier masterid = TableIdentifier.create(catmaster);
    TableIdentifier childid = TableIdentifier.create(catchild);
   
    assertEquals(new TableIdentifier(null, SCHEMA, TABLE1), childid);
    assertEquals(new TableIdentifier(null, SCHEMA, TABLE2), masterid);
  }
View Full Code Here

  /**
   * @param table
   * @return
   */
  protected String toClassName(String table) {
    return cfg.getReverseEngineeringStrategy().tableToClassName(new TableIdentifier(null,null,table) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.reveng.TableIdentifier

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.