Java Code Examples for org.hibernate.mapping.Table#getIndexIterator()
The following examples show how to use
org.hibernate.mapping.Table#getIndexIterator() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: google-cloud-spanner-hibernate File: SpannerTableStatements.java License: GNU Lesser General Public License v2.1 | 5 votes |
private Set<String> getTableIndices(Table table) { Set<String> tableIndices = new HashSet<>(); Iterator<Index> indexIterator = table.getIndexIterator(); while (indexIterator.hasNext()) { tableIndices.add(indexIterator.next().getName()); } Iterator<UniqueKey> keyIterator = table.getUniqueKeyIterator(); while (keyIterator.hasNext()) { tableIndices.add(keyIterator.next().getName()); } return tableIndices; }
Example 2
Source Project: lams File: AbstractSchemaMigrator.java License: GNU General Public License v2.0 | 5 votes |
protected void applyIndexes( Table table, TableInformation tableInformation, Dialect dialect, Metadata metadata, Formatter formatter, ExecutionOptions options, GenerationTarget... targets) { final Exporter<Index> exporter = dialect.getIndexExporter(); final Iterator<Index> indexItr = table.getIndexIterator(); while ( indexItr.hasNext() ) { final Index index = indexItr.next(); if ( !StringHelper.isEmpty( index.getName() ) ) { IndexInformation existingIndex = null; if ( tableInformation != null ) { existingIndex = findMatchingIndex( index, tableInformation ); } if ( existingIndex == null ) { applySqlStrings( false, exporter.getSqlCreateStrings( index, metadata ), formatter, options, targets ); } } } }
Example 3
Source Project: hibernate-ogm-ignite File: IgniteCacheInitializer.java License: GNU Lesser General Public License v2.1 | 5 votes |
/** * Create indexes for {@code @Index} annotations * @param queryEntity * @param context */ private void addUserIndexes(QueryEntity queryEntity, SchemaDefinitionContext context, String tableName) { Namespace namespace = context.getDatabase().getDefaultNamespace(); Optional<Table> tableOptional = namespace.getTables().stream().filter( currentTable -> currentTable.getName().equals( tableName ) ).findFirst(); if ( tableOptional.isPresent() ) { Table table = tableOptional.get(); for ( Iterator<Index> indexIterator = table.getIndexIterator(); indexIterator.hasNext(); ) { Index index = indexIterator.next(); appendIndex( queryEntity, index, context ); } } }