本文整理了Java中org.hibernate.mapping.Index.getColumnIterator()
方法的一些代码示例,展示了Index.getColumnIterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Index.getColumnIterator()
方法的具体详情如下:
包路径:org.hibernate.mapping.Index
类名称:Index
方法名:getColumnIterator
暂无
代码示例来源:origin: hibernate/hibernate-orm
public String sqlConstraintString(Dialect dialect) {
StringBuilder buf = new StringBuilder( " index (" );
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );
if ( iter.hasNext() ) {
buf.append( ", " );
}
}
return buf.append( ')' ).toString();
}
代码示例来源: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 Iterator getIndexIterator() {
List indexes = new ArrayList();
Iterator iter = includedTable.getIndexIterator();
while ( iter.hasNext() ) {
Index parentIndex = (Index) iter.next();
Index index = new Index();
index.setName( getName() + parentIndex.getName() );
index.setTable( this );
index.addColumns( parentIndex.getColumnIterator() );
indexes.add( index );
}
return new JoinedIterator(
indexes.iterator(),
super.getIndexIterator()
);
}
代码示例来源:origin: hibernate/hibernate-orm
final Iterator<Column> columnItr = index.getColumnIterator();
final Map<Column, String> columnOrderMap = index.getColumnOrderMap();
while ( columnItr.hasNext() ) {
代码示例来源:origin: hibernate/hibernate-orm
Iterator<Column> columnItr = index.getColumnIterator();
while ( columnItr.hasNext() ) {
final Column column = columnItr.next();
代码示例来源: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: jboss.jboss-embeddable-ejb3/hibernate-all
public String sqlConstraintString(Dialect dialect) {
StringBuffer buf = new StringBuffer( " index (" );
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );
if ( iter.hasNext() ) buf.append( ", " );
}
return buf.append( ')' ).toString();
}
代码示例来源:origin: hibernate/hibernate
public String sqlConstraintString(Dialect dialect) {
StringBuffer buf = new StringBuffer(" index (");
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName(dialect) );
if ( iter.hasNext() ) buf.append(", ");
}
return buf.append(')').toString();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public String sqlConstraintString(Dialect dialect) {
StringBuffer buf = new StringBuffer( " index (" );
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );
if ( iter.hasNext() ) buf.append( ", " );
}
return buf.append( ')' ).toString();
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
public String sqlConstraintString(Dialect dialect) {
StringBuffer buf = new StringBuffer( " index (" );
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
buf.append( ( (Column) iter.next() ).getQuotedName( dialect ) );
if ( iter.hasNext() ) buf.append( ", " );
}
return buf.append( ')' ).toString();
}
代码示例来源:origin: hibernate/hibernate-ogm
private void addIndex(Label label, Index index) {
if ( index != null ) {
if ( index.getName() != null ) {
log.cannotSetNameForIndex( index.getName() );
}
List<String> properties = CollectionHelper.toStream( index.getColumnIterator() )
.map( Column::getName ).collect( Collectors.toList() );
indexSpecs.add( new Neo4jIndexSpec( label, properties ) );
}
}
代码示例来源: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: 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: 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: com.vecna/dbDiff-hibernate
/**
* Convert a Hibernate index representation to a {@link RelationalIndex}.
* @param mappedIndex hibernate index.
* @param table the table the index applies to.
* @return a {@link RelationalIndex} representation of the index.
*/
private RelationalIndex convertIndex(Index mappedIndex, RelationalTable table) {
@SuppressWarnings("unchecked")
Iterator<org.hibernate.mapping.Column> mappedColumns = mappedIndex.getColumnIterator();
return convertIndex(StringUtils.lowerCase(mappedIndex.getName()), mappedColumns, table);
}
代码示例来源: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() );
}
内容来源于网络,如有侵权,请联系作者删除!