org.hibernate.mapping.Index.getTable()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中org.hibernate.mapping.Index.getTable()方法的一些代码示例,展示了Index.getTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Index.getTable()方法的具体详情如下:
包路径:org.hibernate.mapping.Index
类名称:Index
方法名:getTable

Index.getTable介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

public String sqlCreateString(Dialect dialect, Mapping mapping, String defaultCatalog, String defaultSchema)
    throws HibernateException {
  return buildSqlCreateIndexString(
      dialect,
      getQuotedName( dialect ),
      getTable(),
      getColumnIterator(),
      columnOrderMap,
      false,
      defaultCatalog,
      defaultSchema
  );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
  public String getExportIdentifier() {
    return StringHelper.qualify( getTable().getExportIdentifier(), "IDX-" + getName() );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment();
final String tableName = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
    index.getTable().getQualifiedTableName(),
    dialect
);
  indexNameForCreation = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
      new QualifiedNameImpl(
          index.getTable().getQualifiedTableName().getCatalogName(),
          index.getTable().getQualifiedTableName().getSchemaName(),
          jdbcEnvironment.getIdentifierHelper().toIdentifier( index.getQuotedName( dialect ) )
      ),

代码示例来源:origin: hibernate/hibernate-orm

final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment();
final String tableName = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
    index.getTable().getQualifiedTableName(),
    jdbcEnvironment.getDialect()
);
  indexNameForCreation = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
      new QualifiedNameImpl(
          index.getTable().getQualifiedTableName().getCatalogName(),
          index.getTable().getQualifiedTableName().getSchemaName(),
          jdbcEnvironment.getIdentifierHelper().toIdentifier( index.getName() )
      ),

代码示例来源:origin: hibernate/hibernate-orm

@Override
  public String[] getSqlDropStrings(Index index, Metadata metadata) {
    if ( !dialect.dropConstraints() ) {
      return NO_COMMANDS;
    }

    final JdbcEnvironment jdbcEnvironment = metadata.getDatabase().getJdbcEnvironment();
    final String tableName = jdbcEnvironment.getQualifiedObjectNameFormatter().format(
        index.getTable().getQualifiedTableName(),
        dialect
    );

    final String indexNameForCreation;
    if ( dialect.qualifyIndexName() ) {
      indexNameForCreation = StringHelper.qualify( tableName, index.getName() );
    }
    else {
      indexNameForCreation = index.getName();
    }

    return new String[] { "drop index " + indexNameForCreation };
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testSecondaryTableIndex(){
  PersistentClass entity = metadata().getEntityBinding( Car.class.getName() );
  Join join = (Join)entity.getJoinIterator().next();
  Iterator<Index> itr = join.getTable().getIndexIterator();
  assertTrue( itr.hasNext() );
  Index index = itr.next();
  assertFalse( itr.hasNext() );
  assertTrue( "index name is not generated", StringHelper.isNotEmpty( index.getName() ) );
  assertEquals( 2, index.getColumnSpan() );
  Iterator<Column> columnIterator = index.getColumnIterator();
  Column column = columnIterator.next();
  assertEquals( "dealer_name", column.getName() );
  column = columnIterator.next();
  assertEquals( "rate", column.getName() );
  assertSame( join.getTable(), index.getTable() );
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testCollectionTableIndex(){
  PersistentClass entity = metadata().getEntityBinding( Car.class.getName() );
  Property property = entity.getProperty( "otherDealers" );
  Set set = (Set)property.getValue();
  Table collectionTable = set.getCollectionTable();
  Iterator<Index> itr = collectionTable.getIndexIterator();
  assertTrue( itr.hasNext() );
  Index index = itr.next();
  assertFalse( itr.hasNext() );
  assertTrue( "index name is not generated", StringHelper.isNotEmpty( index.getName() ) );
  assertEquals( 1, index.getColumnSpan() );
  Iterator<Column> columnIterator = index.getColumnIterator();
  Column column = columnIterator.next();
  assertEquals( "name", column.getName() );
  assertSame( collectionTable, index.getTable() );
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testJoinTableIndex(){
  PersistentClass entity = metadata().getEntityBinding( Importer.class.getName() );
  Property property = entity.getProperty( "cars" );
  Bag set = (Bag)property.getValue();
  Table collectionTable = set.getCollectionTable();
  Iterator<Index> itr = collectionTable.getIndexIterator();
  assertTrue( itr.hasNext() );
  Index index = itr.next();
  assertFalse( itr.hasNext() );
  assertTrue( "index name is not generated", StringHelper.isNotEmpty( index.getName() ) );
  assertEquals( 1, index.getColumnSpan() );
  Iterator<Column> columnIterator = index.getColumnIterator();
  Column column = columnIterator.next();
  assertEquals( "importers_id", column.getName() );
  assertSame( collectionTable, index.getTable() );
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
public void testTableIndex() {
  PersistentClass entity = metadata().getEntityBinding( Car.class.getName() );
  Iterator itr = entity.getTable().getUniqueKeyIterator();
  assertTrue( itr.hasNext() );
  UniqueKey uk = (UniqueKey) itr.next();
  assertFalse( itr.hasNext() );
  assertTrue( StringHelper.isNotEmpty( uk.getName() ) );
  assertEquals( 2, uk.getColumnSpan() );
  Column column = (Column) uk.getColumns().get( 0 );
  assertEquals( "brand", column.getName() );
  column = (Column) uk.getColumns().get( 1 );
  assertEquals( "producer", column.getName() );
  assertSame( entity.getTable(), uk.getTable() );
  itr = entity.getTable().getIndexIterator();
  assertTrue( itr.hasNext() );
  Index index = (Index)itr.next();
  assertFalse( itr.hasNext() );
  assertEquals( "Car_idx", index.getName() );
  assertEquals( 1, index.getColumnSpan() );
  column = index.getColumnIterator().next();
  assertEquals( "since", column.getName() );
  assertSame( entity.getTable(), index.getTable() );
}

代码示例来源:origin: org.n52.series.db/dialects

Table table = index.getTable();
Iterator<Column> columns = index.getColumnIterator();
java.util.Map<Column, String> columnOrderMap = new HashMap<Column, String>();

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public String sqlCreateString(Dialect dialect, Mapping mapping, String defaultCatalog, String defaultSchema)
    throws HibernateException {
  return buildSqlCreateIndexString(
      dialect,
      getName(),
      getTable(),
      getColumnIterator(),
      false,
      defaultCatalog,
      defaultSchema
  );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public String sqlCreateString(Dialect dialect, Mapping mapping, String defaultCatalog, String defaultSchema)
    throws HibernateException {
  return buildSqlCreateIndexString(
      dialect,
      getName(),
      getTable(),
      getColumnIterator(),
      false,
      defaultCatalog,
      defaultSchema
  );
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public String sqlCreateString(Dialect dialect, Mapping mapping, String defaultCatalog, String defaultSchema)
    throws HibernateException {
  return buildSqlCreateIndexString(
      dialect,
      getName(),
      getTable(),
      getColumnIterator(),
      false,
      defaultCatalog,
      defaultSchema
  );
}

代码示例来源:origin: hibernate/hibernate

public String sqlCreateString(Dialect dialect, Mapping mapping, String defaultCatalog, String defaultSchema) throws HibernateException {
  return buildSqlCreateIndexString(dialect, getName(), getTable(), getColumnIterator(), false, defaultCatalog, defaultSchema);
}

代码示例来源:origin: hibernate/hibernate-ogm

/**
 * Constructor used for {@link Index}es.
 */
public MongoDBIndexSpec(Index index, Document options) {
  this.indexType = determineIndexType( options );
  this.options = prepareOptions( this.indexType, options, index.getName(), false );
  this.collection = index.getTable().getName();
  this.indexName = index.getName();
  // TODO OGM-1080: the columnOrderMap is not accessible for an Index
  this.addIndexKeys( index.getColumnIterator(), Collections.<Column, String>emptyMap() );
}

代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-mongodb

/**
 * Constructor used for {@link Index}es.
 */
public MongoDBIndexSpec(Index index, Document options) {
  this.indexType = determineIndexType( options );
  this.options = prepareOptions( this.indexType, options, index.getName(), false );
  this.collection = index.getTable().getName();
  this.indexName = index.getName();
  // TODO OGM-1080: the columnOrderMap is not accessible for an Index
  this.addIndexKeys( index.getColumnIterator(), Collections.<Column, String>emptyMap() );
}

代码示例来源:origin: hibernate/hibernate-tools

JdbcUtil.toIdentifier(this, index.getName()));	
Assert.assertEquals(2, index.getColumnSpan() );	
Assert.assertSame(index.getTable(), table);
Iterator<Column> cols = index.getColumnIterator();
Column col1 = cols.next();

相关文章