@SuppressWarnings({"unchecked"}) private void addJoins( PersistentClass pc, CompositeMapperBuilder currentMapper, ClassAuditingData auditingData, String entityName, EntityXmlMappingData xmlMappingData, boolean firstPass) { final Iterator<Join> joins = pc.getJoinIterator(); while ( joins.hasNext() ) { final Join join = joins.next(); final Element joinElement = entitiesJoins.get( entityName ).get( join ); if ( joinElement != null ) { addProperties( joinElement, join.getPropertyIterator(), currentMapper, auditingData, entityName, xmlMappingData, firstPass ); } } }
protected void checkColumnDuplication() { HashSet cols = new HashSet(); if ( getIdentifierMapper() == null ) { //an identifier mapper => getKey will be included in the getNonDuplicatedPropertyIterator() //and checked later, so it needs to be excluded checkColumnDuplication( cols, getKey().getColumnIterator() ); } checkColumnDuplication( cols, getDiscriminatorColumnIterator() ); checkPropertyColumnDuplication( cols, getNonDuplicatedPropertyIterator() ); Iterator iter = getJoinIterator(); while ( iter.hasNext() ) { cols.clear(); Join join = (Join) iter.next(); checkColumnDuplication( cols, join.getKey().getColumnIterator() ); checkPropertyColumnDuplication( cols, join.getPropertyIterator() ); } }
@SuppressWarnings({"unchecked"}) @Test public void testTableNames() { assert "sec_embid_versions".equals( ((Iterator<Join>) metadata().getEntityBinding( "org.hibernate.envers.test.integration.secondary.ids.SecondaryEmbIdTestEntity_AUD" ).getJoinIterator()).next().getTable().getName() ); } }
@SuppressWarnings({"unchecked"}) @Test public void testTableNames() { assert "sec_versions".equals( ((Iterator<Join>) metadata().getEntityBinding( "org.hibernate.envers.test.integration.secondary.SecondaryNamingTestEntity_AUD" ) .getJoinIterator()) .next().getTable().getName() ); } }
@SuppressWarnings({"unchecked"}) @Test public void testTableNames() { assert "secondary_AUD".equals( ((Iterator<Join>) metadata().getEntityBinding( "org.hibernate.envers.test.integration.secondary.SecondaryTestEntity_AUD" ) .getJoinIterator()) .next().getTable().getName() ); } }
@SuppressWarnings({"unchecked"}) @Test public void testTableNames() { assert "sec_mulid_versions".equals( ((Iterator<Join>) metadata().getEntityBinding( "org.hibernate.envers.test.integration.secondary.ids.SecondaryMulIdTestEntity_AUD" ) .getJoinIterator()) .next().getTable().getName() ); } }
Iterator joins = current.getJoinIterator(); while ( !found && joins.hasNext() ) { result = joins.next();
private void associateSubclassNamesToSubclassTableIndexes( PersistentClass persistentClass, Set<String> classNames, String[][] mapping, SessionFactoryImplementor factory) { final String tableName = persistentClass.getTable().getQualifiedName( factory.getDialect(), factory.getSettings().getDefaultCatalogName(), factory.getSettings().getDefaultSchemaName() ); associateSubclassNamesToSubclassTableIndex( tableName, classNames, mapping ); Iterator itr = persistentClass.getJoinIterator(); while ( itr.hasNext() ) { final Join join = (Join) itr.next(); final String secondaryTableName = join.getTable().getQualifiedName( factory.getDialect(), factory.getSettings().getDefaultCatalogName(), factory.getSettings().getDefaultSchemaName() ); associateSubclassNamesToSubclassTableIndex( secondaryTableName, classNames, mapping ); } }
@SuppressWarnings({"unchecked"}) private void createJoins(PersistentClass pc, Element parent, ClassAuditingData auditingData) { final Iterator<Join> joins = pc.getJoinIterator(); final Map<Join, Element> joinElements = new HashMap<>(); entitiesJoins.put( pc.getEntityName(), joinElements );
@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() ); }
Iterator joinsIt = referencedEntity.getJoinIterator(); KeyValue key = null; while ( joinsIt.hasNext() ) {
Iterator it = otherSide.getJoinIterator(); Join otherSideJoin = null; while ( it.hasNext() ) {
Iterator joins = current.getJoinIterator(); while ( !found && joins.hasNext() ) { result = joins.next();
Iterator joinsIt = referencedEntity.getJoinIterator(); KeyValue key = null; while ( joinsIt.hasNext() ) {
Iterator it = otherSide.getJoinIterator(); Join otherSideJoin = null; while ( it.hasNext() ) {
protected void checkColumnDuplication() { HashSet cols = new HashSet(); checkColumnDuplication( cols, getKey().getColumnIterator() ); checkColumnDuplication( cols, getDiscriminatorColumnIterator() ); checkPropertyColumnDuplication( cols, getNonDuplicatedPropertyIterator() ); Iterator iter = getJoinIterator(); while ( iter.hasNext() ) { cols.clear(); Join join = (Join) iter.next(); checkColumnDuplication( cols, join.getKey().getColumnIterator() ); checkPropertyColumnDuplication( cols, join.getPropertyIterator() ); } }
protected void checkColumnDuplication() { HashSet cols = new HashSet(); if (getIdentifierMapper() == null ) { //an identifier mapper => getKey will be included in the getNonDuplicatedPropertyIterator() //and checked later, so it needs to be excluded checkColumnDuplication( cols, getKey().getColumnIterator() ); } checkColumnDuplication( cols, getDiscriminatorColumnIterator() ); checkPropertyColumnDuplication( cols, getNonDuplicatedPropertyIterator() ); Iterator iter = getJoinIterator(); while ( iter.hasNext() ) { cols.clear(); Join join = (Join) iter.next(); checkColumnDuplication( cols, join.getKey().getColumnIterator() ); checkPropertyColumnDuplication( cols, join.getPropertyIterator() ); } }
protected void checkColumnDuplication() { HashSet cols = new HashSet(); if (getIdentifierMapper() == null ) { //an identifier mapper => getKey will be included in the getNonDuplicatedPropertyIterator() //and checked later, so it needs to be excluded checkColumnDuplication( cols, getKey().getColumnIterator() ); } checkColumnDuplication( cols, getDiscriminatorColumnIterator() ); checkPropertyColumnDuplication( cols, getNonDuplicatedPropertyIterator() ); Iterator iter = getJoinIterator(); while ( iter.hasNext() ) { cols.clear(); Join join = (Join) iter.next(); checkColumnDuplication( cols, join.getKey().getColumnIterator() ); checkPropertyColumnDuplication( cols, join.getPropertyIterator() ); } }
Iterator joins = current.getJoinIterator(); while ( ! found && joins.hasNext() ) { result = joins.next();
@SuppressWarnings({"unchecked"}) private void createJoins(PersistentClass pc, Element parent, ClassAuditingData auditingData) { final Iterator<Join> joins = pc.getJoinIterator(); final Map<Join, Element> joinElements = new HashMap<>(); entitiesJoins.put( pc.getEntityName(), joinElements );