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

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(87)

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

Table.getOrCreateIndex介绍

暂无

代码示例

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

private void addConstraintToColumns(List<Column> columns) {
    if ( unique ) {
      UniqueKey uniqueKey = table.getOrCreateUniqueKey( indexName );
      for ( Column column : columns ) {
        uniqueKey.addColumn( column );
      }
    }
    else {
      Index index = table.getOrCreateIndex( indexName );
      for ( Column column : columns ) {
        index.addColumn( column );
      }
    }
  }
}

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

keyName = keyNameIdentifier.render( getDatabase().getJdbcEnvironment().getDialect() );
Index index = table.getOrCreateIndex( keyName );
for ( int i = 0; i < columns.length; i++ ) {
  Column column = columns[i];

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

private void addConstraintToColumn(final String columnName ) {
  Column column = table.getColumn(
      new Column(
          buildingContext.getMetadataCollector().getPhysicalColumnName( table, columnName )
      )
  );
  if ( column == null ) {
    throw new AnnotationException(
        "@Index references a unknown column: " + columnName
    );
  }
  if ( unique ) {
    table.getOrCreateUniqueKey( indexName ).addColumn( column );
  }
  else {
    table.getOrCreateIndex( indexName ).addColumn( column );
  }
}

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

table.getOrCreateIndex( name ).addColumn( column );

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

private void addConstraintToColumn(String columnName) {
    Column column = table.getColumn(
        new Column(
            mappings.getPhysicalColumnName( columnName, table )
        )
    );
    if ( column == null ) {
      throw new AnnotationException(
          "@Index references a unknown column: " + columnName
      );
    }
    if ( unique )
      table.getOrCreateUniqueKey( indexName ).addColumn( column );
    else
      table.getOrCreateIndex( indexName ).addColumn( column );
  }
}

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

private static void bindIndex(Attribute indexAttribute, Table table, Column column) {
  if ( indexAttribute != null && table != null ) {
    StringTokenizer tokens = new StringTokenizer( indexAttribute.getValue(), ", " );
    while ( tokens.hasMoreTokens() ) {
      table.getOrCreateIndex( tokens.nextToken() ).addColumn( column );
    }
  }
}

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

private static void bindIndex(Attribute indexAttribute, Table table, Column column, Mappings mappings) {
  if ( indexAttribute != null && table != null ) {
    StringTokenizer tokens = new StringTokenizer( indexAttribute.getValue(), ", " );
    while ( tokens.hasMoreTokens() ) {
      table.getOrCreateIndex( tokens.nextToken() ).addColumn( column );
    }
  }
}

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

private static void bindIndex(Attribute indexAttribute, Table table, Column column, Mappings mappings) {
  if ( indexAttribute != null && table != null ) {
    StringTokenizer tokens = new StringTokenizer( indexAttribute.getValue(), ", " );
    while ( tokens.hasMoreTokens() ) {
      table.getOrCreateIndex( tokens.nextToken() ).addColumn( column );
    }
  }
}

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

private static void bindIndex(Attribute indexAttribute, Table table, Column column, Mappings mappings) {
  if ( indexAttribute != null && table != null ) {
    StringTokenizer tokens = new StringTokenizer( indexAttribute.getValue(), ", " );
    while ( tokens.hasMoreTokens() ) {
      table.getOrCreateIndex( tokens.nextToken() ).addColumn( column );
    }
  }
}

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

private static void bindIndex(String columnName, Column column, ColumnConfig cc, Table table) {
  if (cc == null) {
    return;
  }
  Object indexObj = cc.getIndex();
  String indexDefinition = null;
  if (indexObj instanceof Boolean) {
    Boolean b = (Boolean) indexObj;
    if (b) {
      indexDefinition = columnName + "_idx";
    }
  }
  else if (indexObj != null) {
    indexDefinition = indexObj.toString();
  }
  if (indexDefinition == null) {
    return;
  }
  String[] tokens = indexDefinition.split(",");
  for (int i = 0; i < tokens.length; i++) {
    String index = tokens[i];
    table.getOrCreateIndex(index).addColumn(column);
  }
}

代码示例来源:origin: org.grails/grails-datastore-gorm-hibernate-core

protected void bindIndex(String columnName, Column column, ColumnConfig cc, Table table) {
  if (cc == null) {
    return;
  }
  Object indexObj = cc.getIndex();
  String indexDefinition = null;
  if (indexObj instanceof Boolean) {
    Boolean b = (Boolean) indexObj;
    if (b) {
      indexDefinition = columnName + "_idx";
    }
  }
  else if (indexObj != null) {
    indexDefinition = indexObj.toString();
  }
  if (indexDefinition == null) {
    return;
  }
  String[] tokens = indexDefinition.split(",");
  for (int i = 0; i < tokens.length; i++) {
    String index = tokens[i];
    table.getOrCreateIndex(index).addColumn(column);
  }
}

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

private void addIndexToColumn(String columnName) {
    Column column = table.getColumn(
        new Column(
            mappings.getPhysicalColumnName( columnName, table )
        )
    );
    if ( column == null ) {
      throw new AnnotationException(
          "@Index references a unknown column: " + columnName
      );
    }
    table.getOrCreateIndex( indexName ).addColumn( column );
  }
}

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

private void addConstraintToColumn(String columnName) {
    Column column = table.getColumn(
        new Column(
            mappings.getPhysicalColumnName( columnName, table )
        )
    );
    if ( column == null ) {
      throw new AnnotationException(
          "@Index references a unknown column: " + columnName
      );
    }
    if ( unique )
      table.getOrCreateUniqueKey( indexName ).addColumn( column );
    else
      table.getOrCreateIndex( indexName ).addColumn( column );
  }
}

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

private void addConstraintToColumn(String columnName) {
    Column column = table.getColumn(
        new Column(
            mappings.getPhysicalColumnName( columnName, table )
        )
    );
    if ( column == null ) {
      throw new AnnotationException(
          "@Index references a unknown column: " + columnName
      );
    }
    if ( unique )
      table.getOrCreateUniqueKey( indexName ).addColumn( column );
    else
      table.getOrCreateIndex( indexName ).addColumn( column );
  }
}

相关文章

微信公众号

最新文章

更多