Search in sources :

Example 1 with PluralAttributeElementSourceOneToMany

use of org.hibernate.boot.model.source.spi.PluralAttributeElementSourceOneToMany in project hibernate-orm by hibernate.

the class ModelBinder method bindListOrArrayIndex.

public void bindListOrArrayIndex(MappingDocument mappingDocument, final IndexedPluralAttributeSource attributeSource, org.hibernate.mapping.List collectionBinding) {
    final PluralAttributeSequentialIndexSource indexSource = (PluralAttributeSequentialIndexSource) attributeSource.getIndexSource();
    final SimpleValue indexBinding = new SimpleValue(mappingDocument, collectionBinding.getCollectionTable());
    bindSimpleValueType(mappingDocument, indexSource.getTypeInformation(), indexBinding);
    relationalObjectBinder.bindColumnsAndFormulas(mappingDocument, indexSource.getRelationalValueSources(), indexBinding, attributeSource.getElementSource() instanceof PluralAttributeElementSourceOneToMany, new RelationalObjectBinder.ColumnNamingDelegate() {

        @Override
        public Identifier determineImplicitName(final LocalMetadataBuildingContext context) {
            return context.getBuildingOptions().getImplicitNamingStrategy().determineListIndexColumnName(new ImplicitIndexColumnNameSource() {

                @Override
                public AttributePath getPluralAttributePath() {
                    return attributeSource.getAttributePath();
                }

                @Override
                public MetadataBuildingContext getBuildingContext() {
                    return context;
                }
            });
        }
    });
    collectionBinding.setIndex(indexBinding);
    collectionBinding.setBaseIndex(indexSource.getBase());
}
Also used : Identifier(org.hibernate.boot.model.naming.Identifier) PluralAttributeElementSourceOneToMany(org.hibernate.boot.model.source.spi.PluralAttributeElementSourceOneToMany) PluralAttributeSequentialIndexSource(org.hibernate.boot.model.source.spi.PluralAttributeSequentialIndexSource) LocalMetadataBuildingContext(org.hibernate.boot.model.source.spi.LocalMetadataBuildingContext) ImplicitIndexColumnNameSource(org.hibernate.boot.model.naming.ImplicitIndexColumnNameSource) SimpleValue(org.hibernate.mapping.SimpleValue)

Aggregations

Identifier (org.hibernate.boot.model.naming.Identifier)1 ImplicitIndexColumnNameSource (org.hibernate.boot.model.naming.ImplicitIndexColumnNameSource)1 LocalMetadataBuildingContext (org.hibernate.boot.model.source.spi.LocalMetadataBuildingContext)1 PluralAttributeElementSourceOneToMany (org.hibernate.boot.model.source.spi.PluralAttributeElementSourceOneToMany)1 PluralAttributeSequentialIndexSource (org.hibernate.boot.model.source.spi.PluralAttributeSequentialIndexSource)1 SimpleValue (org.hibernate.mapping.SimpleValue)1