Search in sources :

Example 1 with SecondaryTableContainer

use of org.hibernate.boot.jaxb.hbm.spi.SecondaryTableContainer in project hibernate-orm by hibernate.

the class AbstractEntitySourceImpl method buildSecondaryTableMap.

private Map<String, SecondaryTableSource> buildSecondaryTableMap() {
    if (!SecondaryTableContainer.class.isInstance(jaxbEntityMapping)) {
        return Collections.emptyMap();
    }
    final HashMap<String, SecondaryTableSource> secondaryTableSourcesMap = new HashMap<String, SecondaryTableSource>();
    for (final JaxbHbmSecondaryTableType joinElement : ((SecondaryTableContainer) jaxbEntityMapping).getJoin()) {
        final SecondaryTableSourceImpl secondaryTableSource = new SecondaryTableSourceImpl(sourceMappingDocument(), joinElement, getEntityNamingSource(), this);
        final String logicalTableName = secondaryTableSource.getLogicalTableNameForContainedColumns();
        secondaryTableSourcesMap.put(logicalTableName, secondaryTableSource);
        AttributesHelper.processAttributes(sourceMappingDocument(), new AttributesHelper.Callback() {

            @Override
            public AttributeSourceContainer getAttributeSourceContainer() {
                return AbstractEntitySourceImpl.this;
            }

            @Override
            public void addAttributeSource(AttributeSource attributeSource) {
                attributeSources.add(attributeSource);
            }
        }, joinElement.getAttributes(), logicalTableName, NaturalIdMutability.NOT_NATURAL_ID);
    }
    return secondaryTableSourcesMap;
}
Also used : AttributeSourceContainer(org.hibernate.boot.model.source.spi.AttributeSourceContainer) JaxbHbmSecondaryTableType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSecondaryTableType) AttributeSource(org.hibernate.boot.model.source.spi.AttributeSource) HashMap(java.util.HashMap) SecondaryTableSource(org.hibernate.boot.model.source.spi.SecondaryTableSource) SecondaryTableContainer(org.hibernate.boot.jaxb.hbm.spi.SecondaryTableContainer)

Aggregations

HashMap (java.util.HashMap)1 JaxbHbmSecondaryTableType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSecondaryTableType)1 SecondaryTableContainer (org.hibernate.boot.jaxb.hbm.spi.SecondaryTableContainer)1 AttributeSource (org.hibernate.boot.model.source.spi.AttributeSource)1 AttributeSourceContainer (org.hibernate.boot.model.source.spi.AttributeSourceContainer)1 SecondaryTableSource (org.hibernate.boot.model.source.spi.SecondaryTableSource)1