protected Iterator getNonDuplicatedPropertyIterator() { return getUnjoinedPropertyIterator(); }
@SuppressWarnings("unchecked") protected Iterator getNonDuplicatedPropertyIterator() { return new JoinedIterator( getSuperclass().getUnjoinedPropertyIterator(), getUnjoinedPropertyIterator() ); }
@SuppressWarnings({"unchecked"}) public void generateSecondPass( PersistentClass pc, ClassAuditingData auditingData, EntityXmlMappingData xmlMappingData) { final String entityName = pc.getEntityName(); LOG.debugf( "Generating second-pass auditing mapping for entity %s", entityName ); final CompositeMapperBuilder propertyMapper = entitiesConfigurations.get( entityName ).getPropertyMapper(); // Mapping unjoined properties final Element parent = xmlMappingData.getClassMapping(); // HHH-11748 - Generate a second pass for identifiers // This is useful for situations where @Id point to @ManyToOne and @OneToOne associations. idMetadataGenerator.generateSecondPass( entityName, pc ); addProperties( parent, pc.getUnjoinedPropertyIterator(), propertyMapper, auditingData, entityName, xmlMappingData, false ); // Mapping joins (second pass) addJoins( pc, propertyMapper, auditingData, entityName, xmlMappingData, false ); }
private void makeOneToManyMapKeyColumnNullableIfNotInProperty( final XProperty property) { final org.hibernate.mapping.Map map = (org.hibernate.mapping.Map) this.collection; if ( map.isOneToMany() && property.isAnnotationPresent( MapKeyColumn.class ) ) { final Value indexValue = map.getIndex(); if ( indexValue.getColumnSpan() != 1 ) { throw new AssertionFailure( "Map key mapped by @MapKeyColumn does not have 1 column" ); } final Selectable selectable = indexValue.getColumnIterator().next(); if ( selectable.isFormula() ) { throw new AssertionFailure( "Map key mapped by @MapKeyColumn is a Formula" ); } Column column = (Column) map.getIndex().getColumnIterator().next(); if ( !column.isNullable() ) { final PersistentClass persistentClass = ( ( OneToMany ) map.getElement() ).getAssociatedClass(); // check if the index column has been mapped by the associated entity to a property; // @MapKeyColumn only maps a column to the primary table for the one-to-many, so we only // need to check "un-joined" properties. if ( !propertyIteratorContainsColumn( persistentClass.getUnjoinedPropertyIterator(), column ) ) { // The index column is not mapped to an associated entity property so we can // safely make the index column nullable. column.setNullable( true ); } } } }
classMapping, pc.getUnjoinedPropertyIterator(), propertyMapper, auditingData, pc.getEntityName(), xmlMappingData, true
protected Iterator getNonDuplicatedPropertyIterator() { return getUnjoinedPropertyIterator(); }
protected Iterator getNonDuplicatedPropertyIterator() { return getUnjoinedPropertyIterator(); }
protected Iterator getNonDuplicatedPropertyIterator() { return getUnjoinedPropertyIterator(); }
protected Iterator getNonDuplicatedPropertyIterator() { return getUnjoinedPropertyIterator(); }
protected Iterator getNonDuplicatedPropertyIterator() { return getUnjoinedPropertyIterator(); }
public Iterator<?> getProperties(PersistentClass pc) { return new SkipBackRefPropertyIterator(pc.getUnjoinedPropertyIterator()); } }
public Iterator<?> getProperties(PersistentClass pc) { return new SkipBackRefPropertyIterator(pc.getUnjoinedPropertyIterator()); } }
protected Iterator getNonDuplicatedPropertyIterator() { return new JoinedIterator( getSuperclass().getUnjoinedPropertyIterator(), getUnjoinedPropertyIterator() ); }
protected Iterator getNonDuplicatedPropertyIterator() { return new JoinedIterator( getSuperclass().getUnjoinedPropertyIterator(), getUnjoinedPropertyIterator() ); }
protected Iterator getNonDuplicatedPropertyIterator() { return new JoinedIterator( getSuperclass().getUnjoinedPropertyIterator(), getUnjoinedPropertyIterator() ); }
protected Iterator getNonDuplicatedPropertyIterator() { return new JoinedIterator( getSuperclass().getUnjoinedPropertyIterator(), getUnjoinedPropertyIterator() ); }
@Override @SuppressWarnings("unchecked") protected Iterator getNonDuplicatedPropertyIterator() { return new JoinedIterator( getSuperclass().getUnjoinedPropertyIterator(), getUnjoinedPropertyIterator() ); }
@SuppressWarnings({"unchecked"}) public void generateSecondPass( PersistentClass pc, ClassAuditingData auditingData, EntityXmlMappingData xmlMappingData) { final String entityName = pc.getEntityName(); LOG.debugf( "Generating second-pass auditing mapping for entity %s", entityName ); final CompositeMapperBuilder propertyMapper = entitiesConfigurations.get( entityName ).getPropertyMapper(); // Mapping unjoined properties final Element parent = xmlMappingData.getClassMapping(); addProperties( parent, pc.getUnjoinedPropertyIterator(), propertyMapper, auditingData, entityName, xmlMappingData, false ); // Mapping joins (second pass) addJoins( pc, propertyMapper, auditingData, entityName, xmlMappingData, false ); }
private void makeOneToManyMapKeyColumnNullableIfNotInProperty( final XProperty property) { final org.hibernate.mapping.Map map = (org.hibernate.mapping.Map) this.collection; if ( map.isOneToMany() && property.isAnnotationPresent( MapKeyColumn.class ) ) { final Value<?> indexValue = map.getIndex(); if ( indexValue.getColumnSpan() != 1 ) { throw new AssertionFailure( "Map key mapped by @MapKeyColumn does not have 1 column" ); } final MappedColumn mappedColumn = indexValue.getMappedColumns().get( 0 ); if ( mappedColumn.isFormula() ) { throw new AssertionFailure( "Map key mapped by @MapKeyColumn is a Formula" ); } final Column column = (Column) map.getIndex().getMappedColumns().get( 0 ); if ( !column.isNullable() ) { final PersistentClass persistentClass = ( ( OneToMany ) map.getElement() ).getAssociatedClass(); // check if the index column has been mapped by the associated entity to a property; // @MapKeyColumn only maps a column to the primary table for the one-to-many, so we only // need to check "un-joined" properties. if ( !propertyIteratorContainsColumn( persistentClass.getUnjoinedPropertyIterator(), column ) ) { // The index column is not mapped to an associated entity property so we can // safely make the index column nullable. column.setNullable( true ); } } } }
classMapping, pc.getUnjoinedPropertyIterator(), propertyMapper, auditingData, pc.getEntityName(), xmlMappingData, true