HHH-17460 - Ongoing JPA 32 work
- mapping defaults & persistence unit defaults
This commit is contained in:
parent
faaece244b
commit
c5f1c80040
|
@ -223,12 +223,12 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector,
|
||||||
MetadataBuildingOptions options) {
|
MetadataBuildingOptions options) {
|
||||||
this(
|
this(
|
||||||
bootstrapContext,
|
bootstrapContext,
|
||||||
buildContext( bootstrapContext ),
|
createModelBuildingContext( bootstrapContext ),
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SourceModelBuildingContext buildContext(BootstrapContext bootstrapContext) {
|
private static SourceModelBuildingContext createModelBuildingContext(BootstrapContext bootstrapContext) {
|
||||||
final ClassLoaderService classLoaderService = bootstrapContext.getServiceRegistry().getService( ClassLoaderService.class );
|
final ClassLoaderService classLoaderService = bootstrapContext.getServiceRegistry().getService( ClassLoaderService.class );
|
||||||
final ClassLoaderServiceLoading classLoading = new ClassLoaderServiceLoading( classLoaderService );
|
final ClassLoaderServiceLoading classLoading = new ClassLoaderServiceLoading( classLoaderService );
|
||||||
return new SourceModelBuildingContextImpl(
|
return new SourceModelBuildingContextImpl(
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.hibernate.boot.model.TypeDefinitionRegistryStandardImpl;
|
||||||
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
|
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||||
import org.hibernate.boot.spi.MappingDefaults;
|
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ public class MetadataBuildingContextRootImpl implements MetadataBuildingContext
|
||||||
private final String contributor;
|
private final String contributor;
|
||||||
private final BootstrapContext bootstrapContext;
|
private final BootstrapContext bootstrapContext;
|
||||||
private final MetadataBuildingOptions options;
|
private final MetadataBuildingOptions options;
|
||||||
private final MappingDefaults mappingDefaults;
|
private final RootMappingDefaults mappingDefaults;
|
||||||
private final InFlightMetadataCollector metadataCollector;
|
private final InFlightMetadataCollector metadataCollector;
|
||||||
private final ObjectNameNormalizer objectNameNormalizer;
|
private final ObjectNameNormalizer objectNameNormalizer;
|
||||||
private final TypeDefinitionRegistryStandardImpl typeDefinitionRegistry;
|
private final TypeDefinitionRegistryStandardImpl typeDefinitionRegistry;
|
||||||
|
@ -30,11 +29,12 @@ public class MetadataBuildingContextRootImpl implements MetadataBuildingContext
|
||||||
String contributor,
|
String contributor,
|
||||||
BootstrapContext bootstrapContext,
|
BootstrapContext bootstrapContext,
|
||||||
MetadataBuildingOptions options,
|
MetadataBuildingOptions options,
|
||||||
InFlightMetadataCollector metadataCollector) {
|
InFlightMetadataCollector metadataCollector,
|
||||||
|
RootMappingDefaults mappingDefaults) {
|
||||||
this.contributor = contributor;
|
this.contributor = contributor;
|
||||||
this.bootstrapContext = bootstrapContext;
|
this.bootstrapContext = bootstrapContext;
|
||||||
this.options = options;
|
this.options = options;
|
||||||
this.mappingDefaults = options.getMappingDefaults();
|
this.mappingDefaults = mappingDefaults;
|
||||||
this.metadataCollector = metadataCollector;
|
this.metadataCollector = metadataCollector;
|
||||||
this.objectNameNormalizer = new ObjectNameNormalizer() {
|
this.objectNameNormalizer = new ObjectNameNormalizer() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,7 +56,7 @@ public class MetadataBuildingContextRootImpl implements MetadataBuildingContext
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingDefaults getMappingDefaults() {
|
public RootMappingDefaults getEffectiveDefaults() {
|
||||||
return mappingDefaults;
|
return mappingDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,165 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||||
|
*/
|
||||||
|
package org.hibernate.boot.internal;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.CascadeType;
|
||||||
|
import org.hibernate.boot.models.xml.spi.PersistenceUnitMetadata;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
|
import org.hibernate.boot.spi.MappingDefaults;
|
||||||
|
|
||||||
|
import jakarta.persistence.AccessType;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.NullnessHelper.coalesce;
|
||||||
|
import static org.hibernate.internal.util.NullnessHelper.coalesceSuppliedValues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base set of defaults for all mappings
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class RootMappingDefaults implements EffectiveMappingDefaults {
|
||||||
|
private final String catalog;
|
||||||
|
private final String schema;
|
||||||
|
|
||||||
|
private final boolean quoteIdentifiers;
|
||||||
|
|
||||||
|
private final String packageName;
|
||||||
|
private final boolean autoImport;
|
||||||
|
|
||||||
|
private final EnumSet<CascadeType> cascadeTypes;
|
||||||
|
|
||||||
|
private final AccessType propertyAccessType;
|
||||||
|
private final String propertyAccessStrategyName;
|
||||||
|
|
||||||
|
private final org.hibernate.cache.spi.access.AccessType cacheAccessType;
|
||||||
|
|
||||||
|
private final boolean entityLaziness;
|
||||||
|
private final boolean collectionLaziness;
|
||||||
|
|
||||||
|
private final String idColumnName;
|
||||||
|
private final String discriminatorColumnName;
|
||||||
|
private final String tenantIdColumnName;
|
||||||
|
|
||||||
|
public RootMappingDefaults(
|
||||||
|
MappingDefaults mappingDefaults,
|
||||||
|
PersistenceUnitMetadata persistenceUnitMetadata) {
|
||||||
|
this.catalog = coalesceSuppliedValues(
|
||||||
|
mappingDefaults::getImplicitCatalogName,
|
||||||
|
persistenceUnitMetadata::getDefaultCatalog
|
||||||
|
);
|
||||||
|
this.schema = coalesceSuppliedValues(
|
||||||
|
mappingDefaults::getImplicitSchemaName,
|
||||||
|
persistenceUnitMetadata::getDefaultSchema
|
||||||
|
);
|
||||||
|
|
||||||
|
// both use primitive boolean, so true when one is true
|
||||||
|
this.quoteIdentifiers = mappingDefaults.shouldImplicitlyQuoteIdentifiers()
|
||||||
|
|| persistenceUnitMetadata.useQuotedIdentifiers();
|
||||||
|
|
||||||
|
this.packageName = mappingDefaults.getImplicitPackageName();
|
||||||
|
this.autoImport = mappingDefaults.isAutoImportEnabled();
|
||||||
|
|
||||||
|
this.cascadeTypes = persistenceUnitMetadata.getDefaultCascadeTypes();
|
||||||
|
|
||||||
|
this.propertyAccessType = persistenceUnitMetadata.getAccessType();
|
||||||
|
this.propertyAccessStrategyName = coalesceSuppliedValues(
|
||||||
|
mappingDefaults::getImplicitPropertyAccessorName,
|
||||||
|
persistenceUnitMetadata::getDefaultAccessStrategyName
|
||||||
|
);
|
||||||
|
|
||||||
|
this.cacheAccessType = mappingDefaults.getImplicitCacheAccessType();
|
||||||
|
|
||||||
|
this.entityLaziness = mappingDefaults.areEntitiesImplicitlyLazy();
|
||||||
|
this.collectionLaziness = mappingDefaults.areCollectionsImplicitlyLazy();
|
||||||
|
|
||||||
|
this.idColumnName = coalesce(
|
||||||
|
mappingDefaults.getImplicitIdColumnName(),
|
||||||
|
DEFAULT_IDENTIFIER_COLUMN_NAME
|
||||||
|
);
|
||||||
|
this.discriminatorColumnName = coalesce(
|
||||||
|
mappingDefaults.getImplicitDiscriminatorColumnName(),
|
||||||
|
DEFAULT_DISCRIMINATOR_COLUMN_NAME
|
||||||
|
);
|
||||||
|
this.tenantIdColumnName = coalesce(
|
||||||
|
mappingDefaults.getImplicitTenantIdColumnName(),
|
||||||
|
DEFAULT_TENANT_IDENTIFIER_COLUMN_NAME
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultCatalogName() {
|
||||||
|
return catalog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultSchemaName() {
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDefaultQuoteIdentifiers() {
|
||||||
|
return quoteIdentifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultIdColumnName() {
|
||||||
|
return idColumnName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultDiscriminatorColumnName() {
|
||||||
|
return discriminatorColumnName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultTenantIdColumnName() {
|
||||||
|
return tenantIdColumnName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultPackageName() {
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDefaultAutoImport() {
|
||||||
|
return autoImport;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumSet<CascadeType> getDefaultCascadeTypes() {
|
||||||
|
return cascadeTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccessType getDefaultPropertyAccessType() {
|
||||||
|
return propertyAccessType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultAccessStrategyName() {
|
||||||
|
return propertyAccessStrategyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDefaultEntityLaziness() {
|
||||||
|
return entityLaziness;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDefaultCollectionLaziness() {
|
||||||
|
return collectionLaziness;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public org.hibernate.cache.spi.access.AccessType getDefaultCacheAccessType() {
|
||||||
|
return cacheAccessType;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -66,7 +66,7 @@ public class AnyBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bindAny(
|
bindAny(
|
||||||
getCascadeStrategy( null, hibernateCascade, false, forcePersist ),
|
getCascadeStrategy( null, hibernateCascade, false, forcePersist, context ),
|
||||||
//@Any has no cascade attribute
|
//@Any has no cascade attribute
|
||||||
joinColumns,
|
joinColumns,
|
||||||
onDeleteAnn == null ? null : onDeleteAnn.getEnum( "action" ),
|
onDeleteAnn == null ? null : onDeleteAnn.getEnum( "action" ),
|
||||||
|
|
|
@ -966,7 +966,8 @@ public class BinderHelper {
|
||||||
List<jakarta.persistence.CascadeType> ejbCascades,
|
List<jakarta.persistence.CascadeType> ejbCascades,
|
||||||
AnnotationUsage<Cascade> hibernateCascadeAnnotation,
|
AnnotationUsage<Cascade> hibernateCascadeAnnotation,
|
||||||
boolean orphanRemoval,
|
boolean orphanRemoval,
|
||||||
boolean forcePersist) {
|
boolean forcePersist,
|
||||||
|
MetadataBuildingContext context) {
|
||||||
final EnumSet<CascadeType> cascadeTypes = convertToHibernateCascadeType( ejbCascades );
|
final EnumSet<CascadeType> cascadeTypes = convertToHibernateCascadeType( ejbCascades );
|
||||||
final List<CascadeType> hibernateCascades = hibernateCascadeAnnotation == null
|
final List<CascadeType> hibernateCascades = hibernateCascadeAnnotation == null
|
||||||
? null
|
? null
|
||||||
|
@ -981,6 +982,7 @@ public class BinderHelper {
|
||||||
if ( forcePersist ) {
|
if ( forcePersist ) {
|
||||||
cascadeTypes.add( CascadeType.PERSIST );
|
cascadeTypes.add( CascadeType.PERSIST );
|
||||||
}
|
}
|
||||||
|
cascadeTypes.addAll( context.getEffectiveDefaults().getDefaultCascadeTypes() );
|
||||||
return renderCascadeTypeList( cascadeTypes );
|
return renderCascadeTypeList( cascadeTypes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -513,7 +513,8 @@ public abstract class CollectionBinder {
|
||||||
oneToManyAnn.getList( "cascade" ),
|
oneToManyAnn.getList( "cascade" ),
|
||||||
hibernateCascade,
|
hibernateCascade,
|
||||||
oneToManyAnn.getBoolean( "orphanRemoval" ),
|
oneToManyAnn.getBoolean( "orphanRemoval" ),
|
||||||
false
|
false,
|
||||||
|
context
|
||||||
) );
|
) );
|
||||||
collectionBinder.setOneToMany( true );
|
collectionBinder.setOneToMany( true );
|
||||||
}
|
}
|
||||||
|
@ -535,7 +536,8 @@ public abstract class CollectionBinder {
|
||||||
manyToManyAnn.getList( "cascade" ),
|
manyToManyAnn.getList( "cascade" ),
|
||||||
hibernateCascade,
|
hibernateCascade,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
context
|
||||||
) );
|
) );
|
||||||
collectionBinder.setOneToMany( false );
|
collectionBinder.setOneToMany( false );
|
||||||
}
|
}
|
||||||
|
@ -546,7 +548,8 @@ public abstract class CollectionBinder {
|
||||||
null,
|
null,
|
||||||
hibernateCascade,
|
hibernateCascade,
|
||||||
false,
|
false,
|
||||||
false
|
false,
|
||||||
|
context
|
||||||
) );
|
) );
|
||||||
collectionBinder.setOneToMany( false );
|
collectionBinder.setOneToMany( false );
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class ToOneBinder {
|
||||||
final AnnotationUsage<OnDelete> onDelete = property.getAnnotationUsage( OnDelete.class );
|
final AnnotationUsage<OnDelete> onDelete = property.getAnnotationUsage( OnDelete.class );
|
||||||
final AnnotationUsage<JoinTable> joinTable = propertyHolder.getJoinTable( property );
|
final AnnotationUsage<JoinTable> joinTable = propertyHolder.getJoinTable( property );
|
||||||
bindManyToOne(
|
bindManyToOne(
|
||||||
getCascadeStrategy( manyToOne.getList( "cascade" ), hibernateCascade, false, forcePersist ),
|
getCascadeStrategy( manyToOne.getList( "cascade" ), hibernateCascade, false, forcePersist, context ),
|
||||||
joinColumns,
|
joinColumns,
|
||||||
joinTable,
|
joinTable,
|
||||||
!isMandatory( manyToOne.getBoolean( "optional" ), property, notFoundAction ),
|
!isMandatory( manyToOne.getBoolean( "optional" ), property, notFoundAction ),
|
||||||
|
@ -486,7 +486,7 @@ public class ToOneBinder {
|
||||||
final AnnotationUsage<OnDelete> onDelete = property.getAnnotationUsage( OnDelete.class );
|
final AnnotationUsage<OnDelete> onDelete = property.getAnnotationUsage( OnDelete.class );
|
||||||
final AnnotationUsage<JoinTable> joinTable = propertyHolder.getJoinTable( property );
|
final AnnotationUsage<JoinTable> joinTable = propertyHolder.getJoinTable( property );
|
||||||
bindOneToOne(
|
bindOneToOne(
|
||||||
getCascadeStrategy( oneToOne.getList( "cascade" ), hibernateCascade, oneToOne.getBoolean( "orphanRemoval" ), forcePersist ),
|
getCascadeStrategy( oneToOne.getList( "cascade" ), hibernateCascade, oneToOne.getBoolean( "orphanRemoval" ), forcePersist, context ),
|
||||||
joinColumns,
|
joinColumns,
|
||||||
joinTable,
|
joinTable,
|
||||||
!isMandatory( oneToOne.getBoolean( "optional" ), property, notFoundAction ),
|
!isMandatory( oneToOne.getBoolean( "optional" ), property, notFoundAction ),
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class ImplicitNamingStrategyJpaCompliantImpl implements ImplicitNamingStr
|
||||||
@Override
|
@Override
|
||||||
public Identifier determineDiscriminatorColumnName(ImplicitDiscriminatorColumnNameSource source) {
|
public Identifier determineDiscriminatorColumnName(ImplicitDiscriminatorColumnNameSource source) {
|
||||||
return toIdentifier(
|
return toIdentifier(
|
||||||
source.getBuildingContext().getMappingDefaults().getImplicitDiscriminatorColumnName(),
|
source.getBuildingContext().getEffectiveDefaults().getDefaultDiscriminatorColumnName(),
|
||||||
source.getBuildingContext()
|
source.getBuildingContext()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public class ImplicitNamingStrategyJpaCompliantImpl implements ImplicitNamingStr
|
||||||
@Override
|
@Override
|
||||||
public Identifier determineTenantIdColumnName(ImplicitTenantIdColumnNameSource source) {
|
public Identifier determineTenantIdColumnName(ImplicitTenantIdColumnNameSource source) {
|
||||||
return toIdentifier(
|
return toIdentifier(
|
||||||
source.getBuildingContext().getMappingDefaults().getImplicitTenantIdColumnName(),
|
source.getBuildingContext().getEffectiveDefaults().getDefaultTenantIdColumnName(),
|
||||||
source.getBuildingContext()
|
source.getBuildingContext()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ public class ImplicitNamingStrategyJpaCompliantImpl implements ImplicitNamingStr
|
||||||
final MetadataBuildingContext buildingContext = source.getBuildingContext();
|
final MetadataBuildingContext buildingContext = source.getBuildingContext();
|
||||||
return toIdentifier(
|
return toIdentifier(
|
||||||
transformAttributePath( source.getAttributePath() )
|
transformAttributePath( source.getAttributePath() )
|
||||||
+ "_" + buildingContext.getMappingDefaults().getImplicitDiscriminatorColumnName(),
|
+ "_" + buildingContext.getEffectiveDefaults().getDefaultDiscriminatorColumnName(),
|
||||||
buildingContext
|
buildingContext
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ public class ImplicitNamingStrategyJpaCompliantImpl implements ImplicitNamingStr
|
||||||
final MetadataBuildingContext buildingContext = source.getBuildingContext();
|
final MetadataBuildingContext buildingContext = source.getBuildingContext();
|
||||||
return toIdentifier(
|
return toIdentifier(
|
||||||
transformAttributePath( source.getAttributePath() )
|
transformAttributePath( source.getAttributePath() )
|
||||||
+ "_" + buildingContext.getMappingDefaults().getImplicitIdColumnName(),
|
+ "_" + buildingContext.getEffectiveDefaults().getDefaultIdColumnName(),
|
||||||
buildingContext
|
buildingContext
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.hibernate.Internal;
|
||||||
import org.hibernate.boot.MetadataSources;
|
import org.hibernate.boot.MetadataSources;
|
||||||
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
||||||
import org.hibernate.boot.internal.MetadataBuildingContextRootImpl;
|
import org.hibernate.boot.internal.MetadataBuildingContextRootImpl;
|
||||||
|
import org.hibernate.boot.internal.RootMappingDefaults;
|
||||||
import org.hibernate.boot.jaxb.Origin;
|
import org.hibernate.boot.jaxb.Origin;
|
||||||
import org.hibernate.boot.jaxb.SourceType;
|
import org.hibernate.boot.jaxb.SourceType;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping;
|
||||||
|
@ -63,6 +64,7 @@ import org.hibernate.boot.spi.AdditionalMappingContributions;
|
||||||
import org.hibernate.boot.spi.AdditionalMappingContributor;
|
import org.hibernate.boot.spi.AdditionalMappingContributor;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||||
|
import org.hibernate.boot.spi.MappingDefaults;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
import org.hibernate.boot.spi.MetadataContributor;
|
import org.hibernate.boot.spi.MetadataContributor;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
|
@ -193,6 +195,7 @@ public class MetadataBuildingProcess {
|
||||||
final MetadataBuildingOptions options) {
|
final MetadataBuildingOptions options) {
|
||||||
|
|
||||||
final ClassLoaderService classLoaderService = bootstrapContext.getServiceRegistry().getService( ClassLoaderService.class );
|
final ClassLoaderService classLoaderService = bootstrapContext.getServiceRegistry().getService( ClassLoaderService.class );
|
||||||
|
assert classLoaderService != null;
|
||||||
final InFlightMetadataCollectorImpl metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, options );
|
final InFlightMetadataCollectorImpl metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, options );
|
||||||
|
|
||||||
handleTypes( bootstrapContext, options, metadataCollector );
|
handleTypes( bootstrapContext, options, metadataCollector );
|
||||||
|
@ -200,14 +203,16 @@ public class MetadataBuildingProcess {
|
||||||
final DomainModelSource domainModelSource = processManagedResources(
|
final DomainModelSource domainModelSource = processManagedResources(
|
||||||
managedResources,
|
managedResources,
|
||||||
metadataCollector,
|
metadataCollector,
|
||||||
bootstrapContext
|
bootstrapContext,
|
||||||
|
options.getMappingDefaults()
|
||||||
);
|
);
|
||||||
|
|
||||||
final MetadataBuildingContextRootImpl rootMetadataBuildingContext = new MetadataBuildingContextRootImpl(
|
final MetadataBuildingContextRootImpl rootMetadataBuildingContext = new MetadataBuildingContextRootImpl(
|
||||||
"orm",
|
"orm",
|
||||||
bootstrapContext,
|
bootstrapContext,
|
||||||
options,
|
options,
|
||||||
metadataCollector
|
metadataCollector,
|
||||||
|
domainModelSource.getEffectiveMappingDefaults()
|
||||||
);
|
);
|
||||||
|
|
||||||
managedResources.getAttributeConverterDescriptors().forEach( metadataCollector::addAttributeConverter );
|
managedResources.getAttributeConverterDescriptors().forEach( metadataCollector::addAttributeConverter );
|
||||||
|
@ -220,6 +225,32 @@ public class MetadataBuildingProcess {
|
||||||
// to unified model
|
// to unified model
|
||||||
final IndexView jandexView = domainModelSource.getJandexIndex();
|
final IndexView jandexView = domainModelSource.getJandexIndex();
|
||||||
|
|
||||||
|
coordinateProcessors(
|
||||||
|
managedResources,
|
||||||
|
options,
|
||||||
|
rootMetadataBuildingContext,
|
||||||
|
domainModelSource,
|
||||||
|
classLoaderService,
|
||||||
|
metadataCollector,
|
||||||
|
jandexView
|
||||||
|
);
|
||||||
|
|
||||||
|
processAdditionalMappingContributions( metadataCollector, options, classLoaderService, rootMetadataBuildingContext );
|
||||||
|
processAdditionalJaxbMappingProducer( metadataCollector, options, jandexView, classLoaderService, rootMetadataBuildingContext );
|
||||||
|
|
||||||
|
applyExtraQueryImports( managedResources, metadataCollector );
|
||||||
|
|
||||||
|
return metadataCollector.buildMetadataInstance( rootMetadataBuildingContext );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void coordinateProcessors(
|
||||||
|
ManagedResources managedResources,
|
||||||
|
MetadataBuildingOptions options,
|
||||||
|
MetadataBuildingContextRootImpl rootMetadataBuildingContext,
|
||||||
|
DomainModelSource domainModelSource,
|
||||||
|
ClassLoaderService classLoaderService,
|
||||||
|
InFlightMetadataCollectorImpl metadataCollector,
|
||||||
|
IndexView jandexView) {
|
||||||
final MetadataSourceProcessor processor = new MetadataSourceProcessor() {
|
final MetadataSourceProcessor processor = new MetadataSourceProcessor() {
|
||||||
private final MetadataSourceProcessor hbmProcessor = options.isXmlMappingEnabled()
|
private final MetadataSourceProcessor hbmProcessor = options.isXmlMappingEnabled()
|
||||||
? new HbmMetadataSourceProcessorImpl( managedResources, rootMetadataBuildingContext )
|
? new HbmMetadataSourceProcessorImpl( managedResources, rootMetadataBuildingContext )
|
||||||
|
@ -361,20 +392,14 @@ public class MetadataBuildingProcess {
|
||||||
processor.processNamedQueries();
|
processor.processNamedQueries();
|
||||||
|
|
||||||
processor.finishUp();
|
processor.finishUp();
|
||||||
|
|
||||||
processAdditionalMappingContributions( metadataCollector, options, classLoaderService, rootMetadataBuildingContext );
|
|
||||||
processAdditionalJaxbMappingProducer( metadataCollector, options, jandexView, classLoaderService, rootMetadataBuildingContext );
|
|
||||||
|
|
||||||
applyExtraQueryImports( managedResources, metadataCollector );
|
|
||||||
|
|
||||||
return metadataCollector.buildMetadataInstance( rootMetadataBuildingContext );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
public static DomainModelSource processManagedResources(
|
public static DomainModelSource processManagedResources(
|
||||||
ManagedResources managedResources,
|
ManagedResources managedResources,
|
||||||
InFlightMetadataCollector metadataCollector,
|
InFlightMetadataCollector metadataCollector,
|
||||||
BootstrapContext bootstrapContext) {
|
BootstrapContext bootstrapContext,
|
||||||
|
MappingDefaults optionDefaults) {
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// - pre-process the XML
|
// - pre-process the XML
|
||||||
// - collect all known classes
|
// - collect all known classes
|
||||||
|
@ -392,7 +417,12 @@ public class MetadataBuildingProcess {
|
||||||
// - sourceModelBuildingContext
|
// - sourceModelBuildingContext
|
||||||
|
|
||||||
final SourceModelBuildingContext sourceModelBuildingContext = metadataCollector.getSourceModelBuildingContext();
|
final SourceModelBuildingContext sourceModelBuildingContext = metadataCollector.getSourceModelBuildingContext();
|
||||||
final XmlPreProcessingResult xmlPreProcessingResult = XmlPreProcessor.preProcessXmlResources( managedResources );
|
final XmlPreProcessingResult xmlPreProcessingResult = XmlPreProcessor.preProcessXmlResources(
|
||||||
|
managedResources,
|
||||||
|
metadataCollector.getPersistenceUnitMetadata()
|
||||||
|
);
|
||||||
|
|
||||||
|
assert metadataCollector.getPersistenceUnitMetadata() == xmlPreProcessingResult.getPersistenceUnitMetadata();
|
||||||
|
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
final List<String> allKnownClassNames = mutableJoin(
|
final List<String> allKnownClassNames = mutableJoin(
|
||||||
|
@ -434,7 +464,6 @@ public class MetadataBuildingProcess {
|
||||||
// JPA id generator global-ity thing
|
// JPA id generator global-ity thing
|
||||||
final boolean areIdGeneratorsGlobal = true;
|
final boolean areIdGeneratorsGlobal = true;
|
||||||
final ClassDetailsRegistry classDetailsRegistry = sourceModelBuildingContext.getClassDetailsRegistry();
|
final ClassDetailsRegistry classDetailsRegistry = sourceModelBuildingContext.getClassDetailsRegistry();
|
||||||
final AnnotationDescriptorRegistry descriptorRegistry = sourceModelBuildingContext.getAnnotationDescriptorRegistry();
|
|
||||||
final DomainModelCategorizationCollector modelCategorizationCollector = new DomainModelCategorizationCollector(
|
final DomainModelCategorizationCollector modelCategorizationCollector = new DomainModelCategorizationCollector(
|
||||||
areIdGeneratorsGlobal,
|
areIdGeneratorsGlobal,
|
||||||
metadataCollector.getGlobalRegistrations(),
|
metadataCollector.getGlobalRegistrations(),
|
||||||
|
@ -442,11 +471,16 @@ public class MetadataBuildingProcess {
|
||||||
sourceModelBuildingContext
|
sourceModelBuildingContext
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final RootMappingDefaults rootMappingDefaults = new RootMappingDefaults(
|
||||||
|
optionDefaults,
|
||||||
|
xmlPreProcessingResult.getPersistenceUnitMetadata()
|
||||||
|
);
|
||||||
final XmlProcessingResult xmlProcessingResult = XmlProcessor.processXml(
|
final XmlProcessingResult xmlProcessingResult = XmlProcessor.processXml(
|
||||||
xmlPreProcessingResult,
|
xmlPreProcessingResult,
|
||||||
modelCategorizationCollector,
|
modelCategorizationCollector,
|
||||||
sourceModelBuildingContext,
|
sourceModelBuildingContext,
|
||||||
bootstrapContext
|
bootstrapContext,
|
||||||
|
rootMappingDefaults
|
||||||
);
|
);
|
||||||
|
|
||||||
final HashSet<String> categorizedClassNames = new HashSet<>();
|
final HashSet<String> categorizedClassNames = new HashSet<>();
|
||||||
|
@ -470,6 +504,7 @@ public class MetadataBuildingProcess {
|
||||||
jandexIndex,
|
jandexIndex,
|
||||||
allKnownClassNames,
|
allKnownClassNames,
|
||||||
modelCategorizationCollector.getGlobalRegistrations(),
|
modelCategorizationCollector.getGlobalRegistrations(),
|
||||||
|
rootMappingDefaults,
|
||||||
xmlPreProcessingResult.getPersistenceUnitMetadata()
|
xmlPreProcessingResult.getPersistenceUnitMetadata()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -718,7 +753,8 @@ public class MetadataBuildingProcess {
|
||||||
AnnotationMetadataSourceProcessorImpl.processAdditionalMappings(
|
AnnotationMetadataSourceProcessorImpl.processAdditionalMappings(
|
||||||
additionalEntityClasses,
|
additionalEntityClasses,
|
||||||
additionalJaxbMappings,
|
additionalJaxbMappings,
|
||||||
rootMetadataBuildingContext
|
rootMetadataBuildingContext,
|
||||||
|
options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.model.source.internal;
|
package org.hibernate.boot.model.source.internal;
|
||||||
|
|
||||||
import org.hibernate.boot.spi.MappingDefaults;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.CascadeType;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.cache.spi.access.AccessType;
|
import org.hibernate.cache.spi.access.AccessType;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.metamodel.CollectionClassification;
|
import org.hibernate.metamodel.CollectionClassification;
|
||||||
|
@ -16,7 +19,7 @@ import org.hibernate.metamodel.CollectionClassification;
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class OverriddenMappingDefaults implements MappingDefaults {
|
public class OverriddenMappingDefaults implements EffectiveMappingDefaults {
|
||||||
private final String implicitSchemaName;
|
private final String implicitSchemaName;
|
||||||
private final String implicitCatalogName;
|
private final String implicitCatalogName;
|
||||||
private final boolean implicitlyQuoteIdentifiers;
|
private final boolean implicitlyQuoteIdentifiers;
|
||||||
|
@ -25,7 +28,7 @@ public class OverriddenMappingDefaults implements MappingDefaults {
|
||||||
private final String implicitDiscriminatorColumnName;
|
private final String implicitDiscriminatorColumnName;
|
||||||
private final String implicitPackageName;
|
private final String implicitPackageName;
|
||||||
private final boolean autoImportEnabled;
|
private final boolean autoImportEnabled;
|
||||||
private final String implicitCascadeStyleName;
|
private final jakarta.persistence.AccessType implicitPropertyAccessType;
|
||||||
private final String implicitPropertyAccessorName;
|
private final String implicitPropertyAccessorName;
|
||||||
private final boolean entitiesImplicitlyLazy;
|
private final boolean entitiesImplicitlyLazy;
|
||||||
private final boolean pluralAttributesImplicitlyLazy;
|
private final boolean pluralAttributesImplicitlyLazy;
|
||||||
|
@ -42,6 +45,7 @@ public class OverriddenMappingDefaults implements MappingDefaults {
|
||||||
String implicitPackageName,
|
String implicitPackageName,
|
||||||
boolean autoImportEnabled,
|
boolean autoImportEnabled,
|
||||||
String implicitCascadeStyleName,
|
String implicitCascadeStyleName,
|
||||||
|
jakarta.persistence.AccessType implicitPropertyAccessType,
|
||||||
String implicitPropertyAccessorName,
|
String implicitPropertyAccessorName,
|
||||||
boolean entitiesImplicitlyLazy,
|
boolean entitiesImplicitlyLazy,
|
||||||
boolean pluralAttributesImplicitlyLazy,
|
boolean pluralAttributesImplicitlyLazy,
|
||||||
|
@ -55,7 +59,7 @@ public class OverriddenMappingDefaults implements MappingDefaults {
|
||||||
this.implicitDiscriminatorColumnName = implicitDiscriminatorColumnName;
|
this.implicitDiscriminatorColumnName = implicitDiscriminatorColumnName;
|
||||||
this.implicitPackageName = implicitPackageName;
|
this.implicitPackageName = implicitPackageName;
|
||||||
this.autoImportEnabled = autoImportEnabled;
|
this.autoImportEnabled = autoImportEnabled;
|
||||||
this.implicitCascadeStyleName = implicitCascadeStyleName;
|
this.implicitPropertyAccessType = implicitPropertyAccessType;
|
||||||
this.implicitPropertyAccessorName = implicitPropertyAccessorName;
|
this.implicitPropertyAccessorName = implicitPropertyAccessorName;
|
||||||
this.entitiesImplicitlyLazy = entitiesImplicitlyLazy;
|
this.entitiesImplicitlyLazy = entitiesImplicitlyLazy;
|
||||||
this.pluralAttributesImplicitlyLazy = pluralAttributesImplicitlyLazy;
|
this.pluralAttributesImplicitlyLazy = pluralAttributesImplicitlyLazy;
|
||||||
|
@ -64,72 +68,77 @@ public class OverriddenMappingDefaults implements MappingDefaults {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImplicitSchemaName() {
|
public String getDefaultSchemaName() {
|
||||||
return implicitSchemaName;
|
return implicitSchemaName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImplicitCatalogName() {
|
public String getDefaultCatalogName() {
|
||||||
return implicitCatalogName;
|
return implicitCatalogName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldImplicitlyQuoteIdentifiers() {
|
public boolean isDefaultQuoteIdentifiers() {
|
||||||
return implicitlyQuoteIdentifiers;
|
return implicitlyQuoteIdentifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImplicitIdColumnName() {
|
public String getDefaultIdColumnName() {
|
||||||
return implicitIdColumnName;
|
return implicitIdColumnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImplicitTenantIdColumnName() {
|
public String getDefaultDiscriminatorColumnName() {
|
||||||
return implicitTenantIdColumnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getImplicitDiscriminatorColumnName() {
|
|
||||||
return implicitDiscriminatorColumnName;
|
return implicitDiscriminatorColumnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImplicitPackageName() {
|
public String getDefaultTenantIdColumnName() {
|
||||||
|
return implicitTenantIdColumnName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultPackageName() {
|
||||||
return implicitPackageName;
|
return implicitPackageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAutoImportEnabled() {
|
public boolean isDefaultAutoImport() {
|
||||||
return autoImportEnabled;
|
return autoImportEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImplicitCascadeStyleName() {
|
public EnumSet<CascadeType> getDefaultCascadeTypes() {
|
||||||
return implicitCascadeStyleName;
|
return EnumSet.noneOf( CascadeType.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getImplicitPropertyAccessorName() {
|
public jakarta.persistence.AccessType getDefaultPropertyAccessType() {
|
||||||
|
return implicitPropertyAccessType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultAccessStrategyName() {
|
||||||
return implicitPropertyAccessorName;
|
return implicitPropertyAccessorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean areEntitiesImplicitlyLazy() {
|
public boolean isDefaultEntityLaziness() {
|
||||||
return entitiesImplicitlyLazy;
|
return entitiesImplicitlyLazy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean areCollectionsImplicitlyLazy() {
|
public boolean isDefaultCollectionLaziness() {
|
||||||
return pluralAttributesImplicitlyLazy;
|
return pluralAttributesImplicitlyLazy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AccessType getImplicitCacheAccessType() {
|
public AccessType getDefaultCacheAccessType() {
|
||||||
return implicitCacheAccessType;
|
return implicitCacheAccessType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CollectionClassification getImplicitListClassification() {
|
public CollectionClassification getDefaultListClassification() {
|
||||||
return implicitListClassification;
|
return implicitListClassification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,27 +152,27 @@ public class OverriddenMappingDefaults implements MappingDefaults {
|
||||||
private String implicitPackageName;
|
private String implicitPackageName;
|
||||||
private boolean autoImportEnabled;
|
private boolean autoImportEnabled;
|
||||||
private String implicitCascadeStyleName;
|
private String implicitCascadeStyleName;
|
||||||
|
private jakarta.persistence.AccessType implicitPropertyAccessType;
|
||||||
private String implicitPropertyAccessorName;
|
private String implicitPropertyAccessorName;
|
||||||
private boolean entitiesImplicitlyLazy;
|
private boolean entitiesImplicitlyLazy;
|
||||||
private boolean pluralAttributesImplicitlyLazy;
|
private boolean pluralAttributesImplicitlyLazy;
|
||||||
private AccessType implicitCacheAccessType;
|
private AccessType implicitCacheAccessType;
|
||||||
private CollectionClassification implicitListClassification;
|
private CollectionClassification implicitListClassification;
|
||||||
|
|
||||||
public Builder(MappingDefaults parentDefaults) {
|
public Builder(EffectiveMappingDefaults parentDefaults) {
|
||||||
this.implicitSchemaName = parentDefaults.getImplicitSchemaName();
|
this.implicitSchemaName = parentDefaults.getDefaultSchemaName();
|
||||||
this.implicitCatalogName = parentDefaults.getImplicitCatalogName();
|
this.implicitCatalogName = parentDefaults.getDefaultCatalogName();
|
||||||
this.implicitlyQuoteIdentifiers = parentDefaults.shouldImplicitlyQuoteIdentifiers();
|
this.implicitlyQuoteIdentifiers = parentDefaults.isDefaultQuoteIdentifiers();
|
||||||
this.implicitIdColumnName = parentDefaults.getImplicitIdColumnName();
|
this.implicitIdColumnName = parentDefaults.getDefaultIdColumnName();
|
||||||
this.implicitTenantIdColumnName = parentDefaults.getImplicitTenantIdColumnName();
|
this.implicitTenantIdColumnName = parentDefaults.getDefaultTenantIdColumnName();
|
||||||
this.implicitDiscriminatorColumnName = parentDefaults.getImplicitDiscriminatorColumnName();
|
this.implicitDiscriminatorColumnName = parentDefaults.getDefaultDiscriminatorColumnName();
|
||||||
this.implicitPackageName = parentDefaults.getImplicitPackageName();
|
this.implicitPackageName = parentDefaults.getDefaultPackageName();
|
||||||
this.autoImportEnabled = parentDefaults.isAutoImportEnabled();
|
this.autoImportEnabled = parentDefaults.isDefaultAutoImport();
|
||||||
this.implicitCascadeStyleName = parentDefaults.getImplicitCascadeStyleName();
|
this.implicitCascadeStyleName = "none";
|
||||||
this.implicitPropertyAccessorName = parentDefaults.getImplicitPropertyAccessorName();
|
this.implicitPropertyAccessorName = parentDefaults.getDefaultAccessStrategyName();
|
||||||
this.entitiesImplicitlyLazy = parentDefaults.areEntitiesImplicitlyLazy();
|
this.entitiesImplicitlyLazy = parentDefaults.isDefaultEntityLaziness();
|
||||||
this.pluralAttributesImplicitlyLazy = parentDefaults.areCollectionsImplicitlyLazy();
|
this.pluralAttributesImplicitlyLazy = parentDefaults.isDefaultCollectionLaziness();
|
||||||
this.implicitCacheAccessType = parentDefaults.getImplicitCacheAccessType();
|
this.implicitCacheAccessType = parentDefaults.getDefaultCacheAccessType();
|
||||||
this.implicitListClassification = parentDefaults.getImplicitListClassification();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setImplicitSchemaName(String implicitSchemaName) {
|
public Builder setImplicitSchemaName(String implicitSchemaName) {
|
||||||
|
@ -225,6 +234,13 @@ public class OverriddenMappingDefaults implements MappingDefaults {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setImplicitPropertyAccessType(jakarta.persistence.AccessType accessType) {
|
||||||
|
if ( accessType != null ) {
|
||||||
|
this.implicitPropertyAccessType = accessType;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setImplicitPropertyAccessorName(String implicitPropertyAccessorName) {
|
public Builder setImplicitPropertyAccessorName(String implicitPropertyAccessorName) {
|
||||||
if ( StringHelper.isNotEmpty( implicitPropertyAccessorName ) ) {
|
if ( StringHelper.isNotEmpty( implicitPropertyAccessorName ) ) {
|
||||||
this.implicitPropertyAccessorName = implicitPropertyAccessorName;
|
this.implicitPropertyAccessorName = implicitPropertyAccessorName;
|
||||||
|
@ -271,6 +287,7 @@ public class OverriddenMappingDefaults implements MappingDefaults {
|
||||||
implicitPackageName,
|
implicitPackageName,
|
||||||
autoImportEnabled,
|
autoImportEnabled,
|
||||||
implicitCascadeStyleName,
|
implicitCascadeStyleName,
|
||||||
|
implicitPropertyAccessType,
|
||||||
implicitPropertyAccessorName,
|
implicitPropertyAccessorName,
|
||||||
entitiesImplicitlyLazy,
|
entitiesImplicitlyLazy,
|
||||||
pluralAttributesImplicitlyLazy,
|
pluralAttributesImplicitlyLazy,
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.boot.model.source.internal.annotations;
|
package org.hibernate.boot.model.source.internal.annotations;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -28,26 +27,16 @@ import org.hibernate.boot.model.source.spi.MetadataSourceProcessor;
|
||||||
import org.hibernate.boot.models.categorize.spi.FilterDefRegistration;
|
import org.hibernate.boot.models.categorize.spi.FilterDefRegistration;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.boot.spi.JpaOrmXmlPersistenceUnitDefaultAware;
|
import org.hibernate.boot.spi.JpaOrmXmlPersistenceUnitDefaultAware;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
|
||||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
import org.hibernate.engine.spi.FilterDefinition;
|
import org.hibernate.engine.spi.FilterDefinition;
|
||||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
|
||||||
import org.hibernate.models.spi.ClassDetails;
|
import org.hibernate.models.spi.ClassDetails;
|
||||||
import org.hibernate.models.spi.ClassDetailsRegistry;
|
import org.hibernate.models.spi.ClassDetailsRegistry;
|
||||||
import org.hibernate.type.descriptor.java.JavaType;
|
|
||||||
import org.hibernate.usertype.UserType;
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import jakarta.persistence.AttributeConverter;
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
|
||||||
import static org.hibernate.boot.jaxb.SourceType.OTHER;
|
import static org.hibernate.boot.jaxb.SourceType.OTHER;
|
||||||
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveAttributeConverter;
|
|
||||||
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveBasicType;
|
|
||||||
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveJavaType;
|
|
||||||
import static org.hibernate.boot.model.internal.AnnotationHelper.resolveUserType;
|
|
||||||
import static org.hibernate.models.spi.ClassDetails.VOID_CLASS_DETAILS;
|
import static org.hibernate.models.spi.ClassDetails.VOID_CLASS_DETAILS;
|
||||||
import static org.hibernate.models.spi.ClassDetails.VOID_OBJECT_CLASS_DETAILS;
|
import static org.hibernate.models.spi.ClassDetails.VOID_OBJECT_CLASS_DETAILS;
|
||||||
|
|
||||||
|
@ -127,7 +116,8 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
||||||
public static void processAdditionalMappings(
|
public static void processAdditionalMappings(
|
||||||
List<Class<?>> additionalClasses,
|
List<Class<?>> additionalClasses,
|
||||||
List<JaxbEntityMappingsImpl> additionalJaxbMappings,
|
List<JaxbEntityMappingsImpl> additionalJaxbMappings,
|
||||||
MetadataBuildingContextRootImpl rootMetadataBuildingContext) {
|
MetadataBuildingContextRootImpl rootMetadataBuildingContext,
|
||||||
|
MetadataBuildingOptions options) {
|
||||||
final AdditionalManagedResourcesImpl.Builder mrBuilder = new AdditionalManagedResourcesImpl.Builder();
|
final AdditionalManagedResourcesImpl.Builder mrBuilder = new AdditionalManagedResourcesImpl.Builder();
|
||||||
mrBuilder.addLoadedClasses( additionalClasses );
|
mrBuilder.addLoadedClasses( additionalClasses );
|
||||||
for ( JaxbEntityMappingsImpl additionalJaxbMapping : additionalJaxbMappings ) {
|
for ( JaxbEntityMappingsImpl additionalJaxbMapping : additionalJaxbMappings ) {
|
||||||
|
@ -138,7 +128,8 @@ public class AnnotationMetadataSourceProcessorImpl implements MetadataSourceProc
|
||||||
final DomainModelSource additionalDomainModelSource = MetadataBuildingProcess.processManagedResources(
|
final DomainModelSource additionalDomainModelSource = MetadataBuildingProcess.processManagedResources(
|
||||||
mr,
|
mr,
|
||||||
rootMetadataBuildingContext.getMetadataCollector(),
|
rootMetadataBuildingContext.getMetadataCollector(),
|
||||||
rootMetadataBuildingContext.getBootstrapContext()
|
rootMetadataBuildingContext.getBootstrapContext(),
|
||||||
|
options.getMappingDefaults()
|
||||||
);
|
);
|
||||||
final AnnotationMetadataSourceProcessorImpl processor = new AnnotationMetadataSourceProcessorImpl( mr, additionalDomainModelSource, rootMetadataBuildingContext );
|
final AnnotationMetadataSourceProcessorImpl processor = new AnnotationMetadataSourceProcessorImpl( mr, additionalDomainModelSource, rootMetadataBuildingContext );
|
||||||
processor.processEntityHierarchies( new LinkedHashSet<>() );
|
processor.processEntityHierarchies( new LinkedHashSet<>() );
|
||||||
|
|
|
@ -9,11 +9,11 @@ package org.hibernate.boot.model.source.internal.annotations;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.hibernate.boot.internal.RootMappingDefaults;
|
||||||
import org.hibernate.boot.models.categorize.spi.ConversionRegistration;
|
import org.hibernate.boot.models.categorize.spi.ConversionRegistration;
|
||||||
import org.hibernate.boot.models.categorize.spi.ConverterRegistration;
|
import org.hibernate.boot.models.categorize.spi.ConverterRegistration;
|
||||||
import org.hibernate.boot.models.categorize.spi.GlobalRegistrations;
|
import org.hibernate.boot.models.categorize.spi.GlobalRegistrations;
|
||||||
import org.hibernate.boot.models.xml.spi.PersistenceUnitMetadata;
|
import org.hibernate.boot.models.xml.spi.PersistenceUnitMetadata;
|
||||||
import org.hibernate.models.spi.ClassDetails;
|
|
||||||
import org.hibernate.models.spi.ClassDetailsRegistry;
|
import org.hibernate.models.spi.ClassDetailsRegistry;
|
||||||
|
|
||||||
import org.jboss.jandex.IndexView;
|
import org.jboss.jandex.IndexView;
|
||||||
|
@ -24,8 +24,9 @@ import org.jboss.jandex.IndexView;
|
||||||
public class DomainModelSource {
|
public class DomainModelSource {
|
||||||
private final ClassDetailsRegistry classDetailsRegistry;
|
private final ClassDetailsRegistry classDetailsRegistry;
|
||||||
private final IndexView jandexIndex;
|
private final IndexView jandexIndex;
|
||||||
private final PersistenceUnitMetadata persistenceUnitMetadata;
|
|
||||||
private final GlobalRegistrations globalRegistrations;
|
private final GlobalRegistrations globalRegistrations;
|
||||||
|
private final RootMappingDefaults effectiveMappingDefaults;
|
||||||
|
private final PersistenceUnitMetadata persistenceUnitMetadata;
|
||||||
private final List<String> allKnownClassNames;
|
private final List<String> allKnownClassNames;
|
||||||
|
|
||||||
public DomainModelSource(
|
public DomainModelSource(
|
||||||
|
@ -33,12 +34,14 @@ public class DomainModelSource {
|
||||||
IndexView jandexIndex,
|
IndexView jandexIndex,
|
||||||
List<String> allKnownClassNames,
|
List<String> allKnownClassNames,
|
||||||
GlobalRegistrations globalRegistrations,
|
GlobalRegistrations globalRegistrations,
|
||||||
|
RootMappingDefaults effectiveMappingDefaults,
|
||||||
PersistenceUnitMetadata persistenceUnitMetadata) {
|
PersistenceUnitMetadata persistenceUnitMetadata) {
|
||||||
this.classDetailsRegistry = classDetailsRegistry;
|
this.classDetailsRegistry = classDetailsRegistry;
|
||||||
this.jandexIndex = jandexIndex;
|
this.jandexIndex = jandexIndex;
|
||||||
this.persistenceUnitMetadata = persistenceUnitMetadata;
|
|
||||||
this.globalRegistrations = globalRegistrations;
|
|
||||||
this.allKnownClassNames = allKnownClassNames;
|
this.allKnownClassNames = allKnownClassNames;
|
||||||
|
this.globalRegistrations = globalRegistrations;
|
||||||
|
this.effectiveMappingDefaults = effectiveMappingDefaults;
|
||||||
|
this.persistenceUnitMetadata = persistenceUnitMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDetailsRegistry getClassDetailsRegistry() {
|
public ClassDetailsRegistry getClassDetailsRegistry() {
|
||||||
|
@ -49,14 +52,18 @@ public class DomainModelSource {
|
||||||
return jandexIndex;
|
return jandexIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersistenceUnitMetadata getPersistenceUnitMetadata() {
|
|
||||||
return persistenceUnitMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GlobalRegistrations getGlobalRegistrations() {
|
public GlobalRegistrations getGlobalRegistrations() {
|
||||||
return globalRegistrations;
|
return globalRegistrations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RootMappingDefaults getEffectiveMappingDefaults() {
|
||||||
|
return effectiveMappingDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersistenceUnitMetadata getPersistenceUnitMetadata() {
|
||||||
|
return persistenceUnitMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
public List<ConversionRegistration> getConversionRegistrations() {
|
public List<ConversionRegistration> getConversionRegistrations() {
|
||||||
return globalRegistrations.getConverterRegistrations();
|
return globalRegistrations.getConverterRegistrations();
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,7 @@ public abstract class AbstractEntitySourceImpl
|
||||||
@Override
|
@Override
|
||||||
public boolean isLazy() {
|
public boolean isLazy() {
|
||||||
if ( jaxbEntityMapping.isLazy() == null ) {
|
if ( jaxbEntityMapping.isLazy() == null ) {
|
||||||
return metadataBuildingContext().getMappingDefaults().areEntitiesImplicitlyLazy();
|
return metadataBuildingContext().getEffectiveDefaults().isDefaultEntityLaziness();
|
||||||
}
|
}
|
||||||
return jaxbEntityMapping().isLazy();
|
return jaxbEntityMapping().isLazy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ public abstract class AbstractPluralAttributeSourceImpl
|
||||||
this.elementSource = interpretElementType();
|
this.elementSource = interpretElementType();
|
||||||
|
|
||||||
this.fetchCharacteristics = FetchCharacteristicsPluralAttributeImpl.interpret(
|
this.fetchCharacteristics = FetchCharacteristicsPluralAttributeImpl.interpret(
|
||||||
mappingDocument.getMappingDefaults(),
|
mappingDocument.getEffectiveDefaults(),
|
||||||
pluralAttributeJaxbMapping.getFetch(),
|
pluralAttributeJaxbMapping.getFetch(),
|
||||||
pluralAttributeJaxbMapping.getOuterJoin(),
|
pluralAttributeJaxbMapping.getOuterJoin(),
|
||||||
pluralAttributeJaxbMapping.getLazy(),
|
pluralAttributeJaxbMapping.getLazy(),
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class CompositeIdentifierSingularAttributeSourceManyToOneImpl
|
||||||
this.attributeRole = container.getAttributeRoleBase().append( getName() );
|
this.attributeRole = container.getAttributeRoleBase().append( getName() );
|
||||||
|
|
||||||
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretManyToOne(
|
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretManyToOne(
|
||||||
mappingDocument.getMappingDefaults(),
|
mappingDocument.getEffectiveDefaults(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
interpretLazy( mappingDocument, keyManyToOneElement )
|
interpretLazy( mappingDocument, keyManyToOneElement )
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmFetchStyleWithSubselectEnum;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmLazyWithExtraEnum;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmLazyWithExtraEnum;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmOuterJoinEnum;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmOuterJoinEnum;
|
||||||
import org.hibernate.boot.model.source.spi.FetchCharacteristicsPluralAttribute;
|
import org.hibernate.boot.model.source.spi.FetchCharacteristicsPluralAttribute;
|
||||||
import org.hibernate.boot.spi.MappingDefaults;
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.engine.FetchStyle;
|
import org.hibernate.engine.FetchStyle;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ public class FetchCharacteristicsPluralAttributeImpl implements FetchCharacteris
|
||||||
private Integer batchSize;
|
private Integer batchSize;
|
||||||
private boolean extraLazy;
|
private boolean extraLazy;
|
||||||
|
|
||||||
public Builder(MappingDefaults mappingDefaults) {
|
public Builder(EffectiveMappingDefaults mappingDefaults) {
|
||||||
setFetchStyle( FetchStyle.SELECT );
|
setFetchStyle( FetchStyle.SELECT );
|
||||||
if ( mappingDefaults.areCollectionsImplicitlyLazy() ) {
|
if ( mappingDefaults.isDefaultCollectionLaziness() ) {
|
||||||
setFetchTiming( FetchTiming.DELAYED );
|
setFetchTiming( FetchTiming.DELAYED );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -104,7 +104,7 @@ public class FetchCharacteristicsPluralAttributeImpl implements FetchCharacteris
|
||||||
// Static builder methods
|
// Static builder methods
|
||||||
|
|
||||||
public static FetchCharacteristicsPluralAttributeImpl interpret(
|
public static FetchCharacteristicsPluralAttributeImpl interpret(
|
||||||
MappingDefaults mappingDefaults,
|
EffectiveMappingDefaults mappingDefaults,
|
||||||
JaxbHbmFetchStyleWithSubselectEnum fetch,
|
JaxbHbmFetchStyleWithSubselectEnum fetch,
|
||||||
JaxbHbmOuterJoinEnum outerJoin,
|
JaxbHbmOuterJoinEnum outerJoin,
|
||||||
JaxbHbmLazyWithExtraEnum lazy,
|
JaxbHbmLazyWithExtraEnum lazy,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmLazyEnum;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmLazyWithNoProxyEnum;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmLazyWithNoProxyEnum;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmOuterJoinEnum;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmOuterJoinEnum;
|
||||||
import org.hibernate.boot.model.source.spi.FetchCharacteristicsSingularAssociation;
|
import org.hibernate.boot.model.source.spi.FetchCharacteristicsSingularAssociation;
|
||||||
import org.hibernate.boot.spi.MappingDefaults;
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.engine.FetchStyle;
|
import org.hibernate.engine.FetchStyle;
|
||||||
import org.hibernate.engine.FetchTiming;
|
import org.hibernate.engine.FetchTiming;
|
||||||
import org.hibernate.internal.log.DeprecationLogger;
|
import org.hibernate.internal.log.DeprecationLogger;
|
||||||
|
@ -60,7 +60,7 @@ public class FetchCharacteristicsSingularAssociationImpl implements FetchCharact
|
||||||
private boolean unwrapProxies;
|
private boolean unwrapProxies;
|
||||||
|
|
||||||
@SuppressWarnings("UnusedParameters")
|
@SuppressWarnings("UnusedParameters")
|
||||||
public Builder(MappingDefaults mappingDefaults) {
|
public Builder(EffectiveMappingDefaults mappingDefaults) {
|
||||||
//
|
//
|
||||||
// todo : may need to add back a concept of DEFAULT fetch style / timing.
|
// todo : may need to add back a concept of DEFAULT fetch style / timing.
|
||||||
// one option I like is adding a fetchTiming / fetchStyle and
|
// one option I like is adding a fetchTiming / fetchStyle and
|
||||||
|
@ -96,7 +96,7 @@ public class FetchCharacteristicsSingularAssociationImpl implements FetchCharact
|
||||||
// Static builder methods
|
// Static builder methods
|
||||||
|
|
||||||
public static FetchCharacteristicsSingularAssociationImpl interpretManyToOne(
|
public static FetchCharacteristicsSingularAssociationImpl interpretManyToOne(
|
||||||
MappingDefaults mappingDefaults,
|
EffectiveMappingDefaults mappingDefaults,
|
||||||
JaxbHbmFetchStyleEnum fetchMapping,
|
JaxbHbmFetchStyleEnum fetchMapping,
|
||||||
JaxbHbmOuterJoinEnum outerJoinMapping,
|
JaxbHbmOuterJoinEnum outerJoinMapping,
|
||||||
JaxbHbmLazyWithNoProxyEnum lazyMapping) {
|
JaxbHbmLazyWithNoProxyEnum lazyMapping) {
|
||||||
|
@ -155,7 +155,7 @@ public class FetchCharacteristicsSingularAssociationImpl implements FetchCharact
|
||||||
|
|
||||||
|
|
||||||
public static FetchCharacteristicsSingularAssociationImpl interpretManyToManyElement(
|
public static FetchCharacteristicsSingularAssociationImpl interpretManyToManyElement(
|
||||||
MappingDefaults mappingDefaults,
|
EffectiveMappingDefaults mappingDefaults,
|
||||||
JaxbHbmFetchStyleEnum fetchMapping,
|
JaxbHbmFetchStyleEnum fetchMapping,
|
||||||
JaxbHbmOuterJoinEnum outerJoinMapping,
|
JaxbHbmOuterJoinEnum outerJoinMapping,
|
||||||
JaxbHbmLazyEnum lazyMapping) {
|
JaxbHbmLazyEnum lazyMapping) {
|
||||||
|
@ -196,7 +196,7 @@ public class FetchCharacteristicsSingularAssociationImpl implements FetchCharact
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FetchCharacteristicsSingularAssociationImpl interpretOneToOne(
|
public static FetchCharacteristicsSingularAssociationImpl interpretOneToOne(
|
||||||
MappingDefaults mappingDefaults,
|
EffectiveMappingDefaults mappingDefaults,
|
||||||
JaxbHbmFetchStyleEnum fetchMapping,
|
JaxbHbmFetchStyleEnum fetchMapping,
|
||||||
JaxbHbmOuterJoinEnum outerJoinMapping,
|
JaxbHbmOuterJoinEnum outerJoinMapping,
|
||||||
JaxbHbmLazyWithNoProxyEnum lazyMapping,
|
JaxbHbmLazyWithNoProxyEnum lazyMapping,
|
||||||
|
|
|
@ -27,8 +27,8 @@ import org.hibernate.boot.model.source.spi.MetadataSourceProcessor;
|
||||||
import org.hibernate.boot.model.source.spi.ToolingHintContext;
|
import org.hibernate.boot.model.source.spi.ToolingHintContext;
|
||||||
import org.hibernate.boot.query.HbmResultSetMappingDescriptor;
|
import org.hibernate.boot.query.HbmResultSetMappingDescriptor;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||||
import org.hibernate.boot.spi.MappingDefaults;
|
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
@ -47,7 +47,7 @@ public class MappingDocument implements HbmLocalMetadataBuildingContext, Metadat
|
||||||
private final JaxbHbmHibernateMapping documentRoot;
|
private final JaxbHbmHibernateMapping documentRoot;
|
||||||
private final Origin origin;
|
private final Origin origin;
|
||||||
private final MetadataBuildingContext rootBuildingContext;
|
private final MetadataBuildingContext rootBuildingContext;
|
||||||
private final MappingDefaults mappingDefaults;
|
private final EffectiveMappingDefaults mappingDefaults;
|
||||||
|
|
||||||
private final ToolingHintContext toolingHintContext;
|
private final ToolingHintContext toolingHintContext;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class MappingDocument implements HbmLocalMetadataBuildingContext, Metadat
|
||||||
|
|
||||||
// todo : allow for a split in default-lazy for singular/plural
|
// todo : allow for a split in default-lazy for singular/plural
|
||||||
|
|
||||||
this.mappingDefaults = new OverriddenMappingDefaults.Builder( rootBuildingContext.getMappingDefaults() )
|
this.mappingDefaults = new OverriddenMappingDefaults.Builder( rootBuildingContext.getEffectiveDefaults() )
|
||||||
.setImplicitSchemaName( documentRoot.getSchema() )
|
.setImplicitSchemaName( documentRoot.getSchema() )
|
||||||
.setImplicitCatalogName( documentRoot.getCatalog() )
|
.setImplicitCatalogName( documentRoot.getCatalog() )
|
||||||
.setImplicitPackageName( documentRoot.getPackage() )
|
.setImplicitPackageName( documentRoot.getPackage() )
|
||||||
|
@ -112,12 +112,12 @@ public class MappingDocument implements HbmLocalMetadataBuildingContext, Metadat
|
||||||
public String determineEntityName(String entityName, String clazz) {
|
public String determineEntityName(String entityName, String clazz) {
|
||||||
return entityName != null
|
return entityName != null
|
||||||
? entityName
|
? entityName
|
||||||
: qualifyIfNeeded( clazz, mappingDefaults.getImplicitPackageName() );
|
: qualifyIfNeeded( clazz, mappingDefaults.getDefaultPackageName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String qualifyClassName(String name) {
|
public String qualifyClassName(String name) {
|
||||||
return qualifyIfNeeded( name, mappingDefaults.getImplicitPackageName() );
|
return qualifyIfNeeded( name, mappingDefaults.getDefaultPackageName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,7 +141,7 @@ public class MappingDocument implements HbmLocalMetadataBuildingContext, Metadat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingDefaults getMappingDefaults() {
|
public EffectiveMappingDefaults getEffectiveDefaults() {
|
||||||
return mappingDefaults;
|
return mappingDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.boot.model.source.internal.hbm;
|
||||||
|
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
@ -18,6 +19,7 @@ import java.util.Properties;
|
||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.Remove;
|
import org.hibernate.Remove;
|
||||||
|
import org.hibernate.annotations.CascadeType;
|
||||||
import org.hibernate.annotations.SourceType;
|
import org.hibernate.annotations.SourceType;
|
||||||
import org.hibernate.boot.MappingException;
|
import org.hibernate.boot.MappingException;
|
||||||
import org.hibernate.boot.jaxb.Origin;
|
import org.hibernate.boot.jaxb.Origin;
|
||||||
|
@ -430,7 +432,8 @@ public class ModelBinder {
|
||||||
entitySource.getEntityNamingSource().getEntityName()
|
entitySource.getEntityNamingSource().getEntityName()
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( sourceDocument.getMappingDefaults().isAutoImportEnabled() && entitySource.getEntityNamingSource().getEntityName().indexOf( '.' ) > 0 ) {
|
if ( sourceDocument.getEffectiveDefaults().isDefaultAutoImport()
|
||||||
|
&& entitySource.getEntityNamingSource().getEntityName().indexOf( '.' ) > 0 ) {
|
||||||
sourceDocument.getMetadataCollector().addImport(
|
sourceDocument.getMetadataCollector().addImport(
|
||||||
StringHelper.unqualify( entitySource.getEntityNamingSource().getEntityName() ),
|
StringHelper.unqualify( entitySource.getEntityNamingSource().getEntityName() ),
|
||||||
entitySource.getEntityNamingSource().getEntityName()
|
entitySource.getEntityNamingSource().getEntityName()
|
||||||
|
@ -2447,7 +2450,7 @@ public class ModelBinder {
|
||||||
property.setPropertyAccessorName(
|
property.setPropertyAccessorName(
|
||||||
isNotEmpty( propertySource.getPropertyAccessorName() )
|
isNotEmpty( propertySource.getPropertyAccessorName() )
|
||||||
? propertySource.getPropertyAccessorName()
|
? propertySource.getPropertyAccessorName()
|
||||||
: mappingDocument.getMappingDefaults().getImplicitPropertyAccessorName()
|
: mappingDocument.getEffectiveDefaults().getDefaultAccessStrategyName()
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( propertySource instanceof CascadeStyleSource ) {
|
if ( propertySource instanceof CascadeStyleSource ) {
|
||||||
|
@ -2456,7 +2459,7 @@ public class ModelBinder {
|
||||||
property.setCascade(
|
property.setCascade(
|
||||||
isNotEmpty( cascadeStyleSource.getCascadeStyleName() )
|
isNotEmpty( cascadeStyleSource.getCascadeStyleName() )
|
||||||
? cascadeStyleSource.getCascadeStyleName()
|
? cascadeStyleSource.getCascadeStyleName()
|
||||||
: mappingDocument.getMappingDefaults().getImplicitCascadeStyleName()
|
: toCascadeString( mappingDocument.getEffectiveDefaults().getDefaultCascadeTypes() )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2481,6 +2484,25 @@ public class ModelBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String toCascadeString(EnumSet<CascadeType> defaultCascadeTypes) {
|
||||||
|
if ( CollectionHelper.isEmpty( defaultCascadeTypes ) ) {
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean firstPass = true;
|
||||||
|
final StringBuilder buffer = new StringBuilder();
|
||||||
|
for ( CascadeType cascadeType : defaultCascadeTypes ) {
|
||||||
|
if ( firstPass ) {
|
||||||
|
firstPass = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buffer.append( ", " );
|
||||||
|
}
|
||||||
|
buffer.append( cascadeType.name().toLowerCase( Locale.ROOT ) );
|
||||||
|
}
|
||||||
|
return buffer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private static void handleGenerationTiming(
|
private static void handleGenerationTiming(
|
||||||
MappingDocument mappingDocument,
|
MappingDocument mappingDocument,
|
||||||
AttributeSource propertySource,
|
AttributeSource propertySource,
|
||||||
|
@ -3158,7 +3180,7 @@ public class ModelBinder {
|
||||||
if ( isNotEmpty( tableSource.getExplicitTableName() ) ) {
|
if ( isNotEmpty( tableSource.getExplicitTableName() ) ) {
|
||||||
logicalName = toIdentifier(
|
logicalName = toIdentifier(
|
||||||
tableSource.getExplicitTableName(),
|
tableSource.getExplicitTableName(),
|
||||||
mappingDocument.getMappingDefaults().shouldImplicitlyQuoteIdentifiers()
|
mappingDocument.getEffectiveDefaults().isDefaultQuoteIdentifiers()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class PluralAttributeElementSourceManyToManyImpl
|
||||||
: mappingDocument.qualifyClassName( jaxbManyToManyElement.getClazz() );
|
: mappingDocument.qualifyClassName( jaxbManyToManyElement.getClazz() );
|
||||||
|
|
||||||
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretManyToManyElement(
|
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretManyToManyElement(
|
||||||
mappingDocument.getMappingDefaults(),
|
mappingDocument.getEffectiveDefaults(),
|
||||||
jaxbManyToManyElement.getFetch(),
|
jaxbManyToManyElement.getFetch(),
|
||||||
jaxbManyToManyElement.getOuterJoin(),
|
jaxbManyToManyElement.getOuterJoin(),
|
||||||
jaxbManyToManyElement.getLazy()
|
jaxbManyToManyElement.getLazy()
|
||||||
|
|
|
@ -76,7 +76,7 @@ class SingularAttributeSourceManyToOneImpl
|
||||||
this.attributePath = container.getAttributePathBase().append( manyToOneElement.getName() );
|
this.attributePath = container.getAttributePathBase().append( manyToOneElement.getName() );
|
||||||
|
|
||||||
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretManyToOne(
|
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretManyToOne(
|
||||||
mappingDocument.getMappingDefaults(),
|
mappingDocument.getEffectiveDefaults(),
|
||||||
manyToOneElement.getFetch(),
|
manyToOneElement.getFetch(),
|
||||||
manyToOneElement.getOuterJoin(),
|
manyToOneElement.getOuterJoin(),
|
||||||
manyToOneElement.getLazy()
|
manyToOneElement.getLazy()
|
||||||
|
|
|
@ -89,7 +89,7 @@ class SingularAttributeSourceOneToOneImpl
|
||||||
this.attributePath = container.getAttributePathBase().append( oneToOneElement.getName() );
|
this.attributePath = container.getAttributePathBase().append( oneToOneElement.getName() );
|
||||||
|
|
||||||
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretOneToOne(
|
this.fetchCharacteristics = FetchCharacteristicsSingularAssociationImpl.interpretOneToOne(
|
||||||
mappingDocument.getMappingDefaults(),
|
mappingDocument.getEffectiveDefaults(),
|
||||||
oneToOneElement.getFetch(),
|
oneToOneElement.getFetch(),
|
||||||
oneToOneElement.getOuterJoin(),
|
oneToOneElement.getOuterJoin(),
|
||||||
oneToOneElement.getLazy(),
|
oneToOneElement.getLazy(),
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class BindingOptionsImpl implements BindingOptions {
|
||||||
private final EnumSet<QuotedIdentifierTarget> globallyQuotedIdentifierTargets;
|
private final EnumSet<QuotedIdentifierTarget> globallyQuotedIdentifierTargets;
|
||||||
|
|
||||||
public BindingOptionsImpl(MetadataBuildingContext metadataBuildingContext) {
|
public BindingOptionsImpl(MetadataBuildingContext metadataBuildingContext) {
|
||||||
final boolean globallyQuote = metadataBuildingContext.getMappingDefaults().shouldImplicitlyQuoteIdentifiers();
|
final boolean globallyQuote = metadataBuildingContext.getEffectiveDefaults().isDefaultQuoteIdentifiers();
|
||||||
final boolean skipColumnDefinitions = metadataBuildingContext
|
final boolean skipColumnDefinitions = metadataBuildingContext
|
||||||
.getBootstrapContext()
|
.getBootstrapContext()
|
||||||
.getServiceRegistry()
|
.getServiceRegistry()
|
||||||
|
@ -53,13 +53,13 @@ public class BindingOptionsImpl implements BindingOptions {
|
||||||
.getJdbcEnvironment();
|
.getJdbcEnvironment();
|
||||||
|
|
||||||
defaultCatalogName = toIdentifier(
|
defaultCatalogName = toIdentifier(
|
||||||
metadataBuildingContext.getMappingDefaults().getImplicitCatalogName(),
|
metadataBuildingContext.getEffectiveDefaults().getDefaultCatalogName(),
|
||||||
QuotedIdentifierTarget.CATALOG_NAME,
|
QuotedIdentifierTarget.CATALOG_NAME,
|
||||||
globallyQuotedIdentifierTargets,
|
globallyQuotedIdentifierTargets,
|
||||||
jdbcEnvironment
|
jdbcEnvironment
|
||||||
);
|
);
|
||||||
defaultSchemaName = toIdentifier(
|
defaultSchemaName = toIdentifier(
|
||||||
metadataBuildingContext.getMappingDefaults().getImplicitSchemaName(),
|
metadataBuildingContext.getEffectiveDefaults().getDefaultSchemaName(),
|
||||||
QuotedIdentifierTarget.SCHEMA_NAME,
|
QuotedIdentifierTarget.SCHEMA_NAME,
|
||||||
globallyQuotedIdentifierTargets,
|
globallyQuotedIdentifierTargets,
|
||||||
jdbcEnvironment
|
jdbcEnvironment
|
||||||
|
|
|
@ -12,7 +12,11 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.hibernate.Internal;
|
||||||
import org.hibernate.annotations.TenantId;
|
import org.hibernate.annotations.TenantId;
|
||||||
|
import org.hibernate.boot.internal.BootstrapContextImpl;
|
||||||
|
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
||||||
|
import org.hibernate.boot.internal.RootMappingDefaults;
|
||||||
import org.hibernate.boot.model.process.spi.ManagedResources;
|
import org.hibernate.boot.model.process.spi.ManagedResources;
|
||||||
import org.hibernate.boot.models.categorize.ModelCategorizationLogging;
|
import org.hibernate.boot.models.categorize.ModelCategorizationLogging;
|
||||||
import org.hibernate.boot.models.categorize.internal.ClassLoaderServiceLoading;
|
import org.hibernate.boot.models.categorize.internal.ClassLoaderServiceLoading;
|
||||||
|
@ -20,6 +24,7 @@ import org.hibernate.boot.models.categorize.internal.DomainModelCategorizationCo
|
||||||
import org.hibernate.boot.models.categorize.internal.GlobalRegistrationsImpl;
|
import org.hibernate.boot.models.categorize.internal.GlobalRegistrationsImpl;
|
||||||
import org.hibernate.boot.models.categorize.internal.ModelCategorizationContextImpl;
|
import org.hibernate.boot.models.categorize.internal.ModelCategorizationContextImpl;
|
||||||
import org.hibernate.boot.models.categorize.internal.OrmAnnotationHelper;
|
import org.hibernate.boot.models.categorize.internal.OrmAnnotationHelper;
|
||||||
|
import org.hibernate.boot.models.xml.internal.PersistenceUnitMetadataImpl;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlPreProcessingResult;
|
import org.hibernate.boot.models.xml.spi.XmlPreProcessingResult;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlPreProcessor;
|
import org.hibernate.boot.models.xml.spi.XmlPreProcessor;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlProcessingResult;
|
import org.hibernate.boot.models.xml.spi.XmlProcessingResult;
|
||||||
|
@ -27,6 +32,7 @@ import org.hibernate.boot.models.xml.spi.XmlProcessor;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
import org.hibernate.models.internal.SourceModelBuildingContextImpl;
|
import org.hibernate.models.internal.SourceModelBuildingContextImpl;
|
||||||
import org.hibernate.models.internal.jandex.JandexClassDetails;
|
import org.hibernate.models.internal.jandex.JandexClassDetails;
|
||||||
import org.hibernate.models.internal.jandex.JandexIndexerHelper;
|
import org.hibernate.models.internal.jandex.JandexIndexerHelper;
|
||||||
|
@ -55,6 +61,7 @@ import static org.hibernate.internal.util.collections.CollectionHelper.mutableJo
|
||||||
public class ManagedResourcesProcessor {
|
public class ManagedResourcesProcessor {
|
||||||
public static CategorizedDomainModel processManagedResources(
|
public static CategorizedDomainModel processManagedResources(
|
||||||
ManagedResources managedResources,
|
ManagedResources managedResources,
|
||||||
|
MetadataBuildingOptions metadataBuildingOptions,
|
||||||
BootstrapContext bootstrapContext) {
|
BootstrapContext bootstrapContext) {
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -76,7 +83,12 @@ public class ManagedResourcesProcessor {
|
||||||
final ClassLoaderService classLoaderService = bootstrapContext.getServiceRegistry().getService( ClassLoaderService.class );
|
final ClassLoaderService classLoaderService = bootstrapContext.getServiceRegistry().getService( ClassLoaderService.class );
|
||||||
final ClassLoaderServiceLoading classLoading = new ClassLoaderServiceLoading( classLoaderService );
|
final ClassLoaderServiceLoading classLoading = new ClassLoaderServiceLoading( classLoaderService );
|
||||||
|
|
||||||
final XmlPreProcessingResult xmlPreProcessingResult = XmlPreProcessor.preProcessXmlResources( managedResources );
|
final PersistenceUnitMetadataImpl persistenceUnitMetadata = new PersistenceUnitMetadataImpl();
|
||||||
|
|
||||||
|
final XmlPreProcessingResult xmlPreProcessingResult = XmlPreProcessor.preProcessXmlResources(
|
||||||
|
managedResources,
|
||||||
|
persistenceUnitMetadata
|
||||||
|
);
|
||||||
|
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
final List<String> allKnownClassNames = mutableJoin(
|
final List<String> allKnownClassNames = mutableJoin(
|
||||||
|
@ -133,11 +145,16 @@ public class ManagedResourcesProcessor {
|
||||||
sourceModelBuildingContext
|
sourceModelBuildingContext
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final RootMappingDefaults rootMappingDefaults = new RootMappingDefaults(
|
||||||
|
metadataBuildingOptions.getMappingDefaults(),
|
||||||
|
persistenceUnitMetadata
|
||||||
|
);
|
||||||
final XmlProcessingResult xmlProcessingResult = XmlProcessor.processXml(
|
final XmlProcessingResult xmlProcessingResult = XmlProcessor.processXml(
|
||||||
xmlPreProcessingResult,
|
xmlPreProcessingResult,
|
||||||
modelCategorizationCollector,
|
modelCategorizationCollector,
|
||||||
sourceModelBuildingContext,
|
sourceModelBuildingContext,
|
||||||
bootstrapContext
|
bootstrapContext,
|
||||||
|
rootMappingDefaults
|
||||||
);
|
);
|
||||||
|
|
||||||
allKnownClassNames.forEach( (className) -> {
|
allKnownClassNames.forEach( (className) -> {
|
||||||
|
@ -281,4 +298,17 @@ public class ManagedResourcesProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For testing use only
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public static CategorizedDomainModel processManagedResources(
|
||||||
|
ManagedResources managedResources,
|
||||||
|
BootstrapContext bootstrapContext) {
|
||||||
|
return processManagedResources(
|
||||||
|
managedResources,
|
||||||
|
new MetadataBuilderImpl.MetadataBuildingOptionsImpl( bootstrapContext.getServiceRegistry() ),
|
||||||
|
bootstrapContext
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class ManagedTypeProcessor {
|
||||||
classAccessType = coalesce(
|
classAccessType = coalesce(
|
||||||
jaxbEntity.getAccess(),
|
jaxbEntity.getAccess(),
|
||||||
jaxbRoot.getAccess(),
|
jaxbRoot.getAccess(),
|
||||||
xmlDocumentContext.getPersistenceUnitMetadata().getAccessType(),
|
xmlDocumentContext.getEffectiveDefaults().getDefaultPropertyAccessType(),
|
||||||
AccessType.PROPERTY
|
AccessType.PROPERTY
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,7 @@ public class ManagedTypeProcessor {
|
||||||
// look for @Access on the entity class
|
// look for @Access on the entity class
|
||||||
() -> determineAccessTypeFromClassAnnotations( classDetails ),
|
() -> determineAccessTypeFromClassAnnotations( classDetails ),
|
||||||
// look for a default (PU metadata default) access
|
// look for a default (PU metadata default) access
|
||||||
xmlDocumentContext.getPersistenceUnitMetadata()::getAccessType,
|
xmlDocumentContext.getEffectiveDefaults()::getDefaultPropertyAccessType,
|
||||||
// look at @Id/@EmbeddedId
|
// look at @Id/@EmbeddedId
|
||||||
() -> determineAccessTypeFromClassMembers( classDetails ),
|
() -> determineAccessTypeFromClassMembers( classDetails ),
|
||||||
// fallback to PROPERTY
|
// fallback to PROPERTY
|
||||||
|
@ -781,7 +781,7 @@ public class ManagedTypeProcessor {
|
||||||
|
|
||||||
final AccessType classAccessType = coalesce(
|
final AccessType classAccessType = coalesce(
|
||||||
jaxbMappedSuperclass.getAccess(),
|
jaxbMappedSuperclass.getAccess(),
|
||||||
xmlDocumentContext.getPersistenceUnitMetadata().getAccessType()
|
xmlDocumentContext.getEffectiveDefaults().getDefaultPropertyAccessType()
|
||||||
);
|
);
|
||||||
classDetails.addAnnotationUsage( XmlAnnotationHelper.createAccessAnnotation( classAccessType, classDetails, xmlDocumentContext ) );
|
classDetails.addAnnotationUsage( XmlAnnotationHelper.createAccessAnnotation( classAccessType, classDetails, xmlDocumentContext ) );
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@ public class ManagedTypeProcessor {
|
||||||
classDetails = (MutableClassDetails) classDetailsRegistry.resolveClassDetails( className );
|
classDetails = (MutableClassDetails) classDetailsRegistry.resolveClassDetails( className );
|
||||||
classAccessType = coalesce(
|
classAccessType = coalesce(
|
||||||
jaxbEmbeddable.getAccess(),
|
jaxbEmbeddable.getAccess(),
|
||||||
xmlDocumentContext.getPersistenceUnitMetadata().getAccessType()
|
xmlDocumentContext.getEffectiveDefaults().getDefaultPropertyAccessType()
|
||||||
);
|
);
|
||||||
memberAdjuster = ManagedTypeProcessor::adjustNonDynamicTypeMember;
|
memberAdjuster = ManagedTypeProcessor::adjustNonDynamicTypeMember;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ public final class PersistenceUnitMetadataImpl implements PersistenceUnitMetadat
|
||||||
|
|
||||||
private final EnumSet<CascadeType> defaultCascadeTypes = EnumSet.noneOf( CascadeType.class );
|
private final EnumSet<CascadeType> defaultCascadeTypes = EnumSet.noneOf( CascadeType.class );
|
||||||
|
|
||||||
|
public PersistenceUnitMetadataImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean areXmlMappingsComplete() {
|
public boolean areXmlMappingsComplete() {
|
||||||
return xmlComplete;
|
return xmlComplete;
|
||||||
|
@ -132,7 +135,7 @@ public final class PersistenceUnitMetadataImpl implements PersistenceUnitMetadat
|
||||||
|
|
||||||
if ( defaults.getCascadePersist() != null
|
if ( defaults.getCascadePersist() != null
|
||||||
|| isNotEmpty( defaults.getDefaultCascade() ) ) {
|
|| isNotEmpty( defaults.getDefaultCascade() ) ) {
|
||||||
if ( !defaultCascadeTypes.isEmpty() ) {
|
if ( !this.defaultCascadeTypes.isEmpty() ) {
|
||||||
XML_PROCESS_LOGGER.debugf( "Adding cascades to already defined set of default cascades" );
|
XML_PROCESS_LOGGER.debugf( "Adding cascades to already defined set of default cascades" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,8 +544,8 @@ public class XmlAnnotationHelper {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We always use Hibernate specific org.hibernate.annotations.CascadeType since
|
// We always use Hibernate specific `org.hibernate.annotations.CascadeType`
|
||||||
// it offers additional options than jakarta.persistence.CascadeType
|
// since it is a superset of `jakarta.persistence.CascadeType`
|
||||||
final List<CascadeType> cascadeTypes = new ArrayList<>();
|
final List<CascadeType> cascadeTypes = new ArrayList<>();
|
||||||
if ( jaxbCascadeType.getCascadeAll() != null ) {
|
if ( jaxbCascadeType.getCascadeAll() != null ) {
|
||||||
cascadeTypes.add( CascadeType.ALL );
|
cascadeTypes.add( CascadeType.ALL );
|
||||||
|
|
|
@ -6,10 +6,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.models.xml.internal;
|
package org.hibernate.boot.models.xml.internal;
|
||||||
|
|
||||||
|
import org.hibernate.boot.internal.RootMappingDefaults;
|
||||||
|
import org.hibernate.boot.model.source.internal.OverriddenMappingDefaults;
|
||||||
import org.hibernate.boot.models.xml.spi.PersistenceUnitMetadata;
|
import org.hibernate.boot.models.xml.spi.PersistenceUnitMetadata;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlDocument;
|
import org.hibernate.boot.models.xml.spi.XmlDocument;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlDocumentContext;
|
import org.hibernate.boot.models.xml.spi.XmlDocumentContext;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.models.spi.SourceModelBuildingContext;
|
import org.hibernate.models.spi.SourceModelBuildingContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,17 +21,17 @@ import org.hibernate.models.spi.SourceModelBuildingContext;
|
||||||
*/
|
*/
|
||||||
public class XmlDocumentContextImpl implements XmlDocumentContext {
|
public class XmlDocumentContextImpl implements XmlDocumentContext {
|
||||||
private final XmlDocument xmlDocument;
|
private final XmlDocument xmlDocument;
|
||||||
private final PersistenceUnitMetadata persistenceUnitMetadata;
|
private final EffectiveMappingDefaults effectiveDefaults;
|
||||||
private final SourceModelBuildingContext modelBuildingContext;
|
private final SourceModelBuildingContext modelBuildingContext;
|
||||||
private final BootstrapContext bootstrapContext;
|
private final BootstrapContext bootstrapContext;
|
||||||
|
|
||||||
public XmlDocumentContextImpl(
|
public XmlDocumentContextImpl(
|
||||||
XmlDocument xmlDocument,
|
XmlDocument xmlDocument,
|
||||||
PersistenceUnitMetadata persistenceUnitMetadata,
|
RootMappingDefaults mappingDefaults,
|
||||||
SourceModelBuildingContext modelBuildingContext,
|
SourceModelBuildingContext modelBuildingContext,
|
||||||
BootstrapContext bootstrapContext) {
|
BootstrapContext bootstrapContext) {
|
||||||
this.xmlDocument = xmlDocument;
|
this.xmlDocument = xmlDocument;
|
||||||
this.persistenceUnitMetadata = persistenceUnitMetadata;
|
this.effectiveDefaults = buildEffectiveDefaults( xmlDocument, mappingDefaults );
|
||||||
this.modelBuildingContext = modelBuildingContext;
|
this.modelBuildingContext = modelBuildingContext;
|
||||||
this.bootstrapContext = bootstrapContext;
|
this.bootstrapContext = bootstrapContext;
|
||||||
}
|
}
|
||||||
|
@ -38,8 +42,8 @@ public class XmlDocumentContextImpl implements XmlDocumentContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PersistenceUnitMetadata getPersistenceUnitMetadata() {
|
public EffectiveMappingDefaults getEffectiveDefaults() {
|
||||||
return persistenceUnitMetadata;
|
return effectiveDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -51,4 +55,42 @@ public class XmlDocumentContextImpl implements XmlDocumentContext {
|
||||||
public BootstrapContext getBootstrapContext() {
|
public BootstrapContext getBootstrapContext() {
|
||||||
return bootstrapContext;
|
return bootstrapContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static EffectiveMappingDefaults buildEffectiveDefaults(
|
||||||
|
XmlDocument xmlDocument,
|
||||||
|
RootMappingDefaults mappingDefaults) {
|
||||||
|
final XmlDocument.Defaults documentDefaults = xmlDocument.getDefaults();
|
||||||
|
final OverriddenMappingDefaults.Builder builder = new OverriddenMappingDefaults.Builder( mappingDefaults );
|
||||||
|
|
||||||
|
if ( StringHelper.isNotEmpty( documentDefaults.getCatalog() ) ) {
|
||||||
|
builder.setImplicitCatalogName( documentDefaults.getCatalog() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( StringHelper.isNotEmpty( documentDefaults.getSchema() ) ) {
|
||||||
|
builder.setImplicitSchemaName( documentDefaults.getSchema() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( documentDefaults.isAutoImport() ) {
|
||||||
|
builder.setAutoImportEnabled( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( StringHelper.isNotEmpty( documentDefaults.getPackage() ) ) {
|
||||||
|
builder.setImplicitPackageName( documentDefaults.getPackage() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( documentDefaults.getAccessType() != null ) {
|
||||||
|
builder.setImplicitPropertyAccessType( documentDefaults.getAccessType() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( StringHelper.isNotEmpty( documentDefaults.getAccessorStrategy() ) ) {
|
||||||
|
builder.setImplicitPropertyAccessorName( documentDefaults.getAccessorStrategy() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( documentDefaults.isLazinessImplied() ) {
|
||||||
|
builder.setEntitiesImplicitlyLazy( true );
|
||||||
|
builder.setPluralAttributesImplicitlyLazy( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
|
||||||
|
import org.hibernate.boot.models.xml.spi.PersistenceUnitMetadata;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlPreProcessingResult;
|
import org.hibernate.boot.models.xml.spi.XmlPreProcessingResult;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
|
||||||
|
@ -17,11 +18,26 @@ import org.hibernate.internal.util.StringHelper;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class XmlPreProcessingResultImpl implements XmlPreProcessingResult {
|
public class XmlPreProcessingResultImpl implements XmlPreProcessingResult {
|
||||||
private final PersistenceUnitMetadataImpl persistenceUnitMetadata = new PersistenceUnitMetadataImpl();
|
private final PersistenceUnitMetadataImpl persistenceUnitMetadata;
|
||||||
private final List<JaxbEntityMappingsImpl> documents = new ArrayList<>();
|
private final List<JaxbEntityMappingsImpl> documents = new ArrayList<>();
|
||||||
private final List<String> managedClasses = new ArrayList<>();
|
private final List<String> managedClasses = new ArrayList<>();
|
||||||
private final List<String> managedNames = new ArrayList<>();
|
private final List<String> managedNames = new ArrayList<>();
|
||||||
|
|
||||||
|
public XmlPreProcessingResultImpl(PersistenceUnitMetadataImpl persistenceUnitMetadata) {
|
||||||
|
this.persistenceUnitMetadata = persistenceUnitMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XmlPreProcessingResultImpl(PersistenceUnitMetadata persistenceUnitMetadata) {
|
||||||
|
this( (PersistenceUnitMetadataImpl) persistenceUnitMetadata );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intended for testing
|
||||||
|
*/
|
||||||
|
public XmlPreProcessingResultImpl() {
|
||||||
|
this( new PersistenceUnitMetadataImpl() );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PersistenceUnitMetadataImpl getPersistenceUnitMetadata() {
|
public PersistenceUnitMetadataImpl getPersistenceUnitMetadata() {
|
||||||
return persistenceUnitMetadata;
|
return persistenceUnitMetadata;
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbAnyMappingDiscriminatorImpl;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbAnyMappingImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbAnyMappingImpl;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbAnyMappingKeyImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbAnyMappingKeyImpl;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbColumnImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbColumnImpl;
|
||||||
|
import org.hibernate.boot.models.xml.internal.XmlAnnotationHelper;
|
||||||
import org.hibernate.boot.models.xml.internal.XmlProcessingHelper;
|
import org.hibernate.boot.models.xml.internal.XmlProcessingHelper;
|
||||||
import org.hibernate.boot.models.xml.internal.db.ColumnProcessing;
|
import org.hibernate.boot.models.xml.internal.db.ColumnProcessing;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlDocumentContext;
|
import org.hibernate.boot.models.xml.spi.XmlDocumentContext;
|
||||||
|
@ -61,6 +62,7 @@ public class AnyMappingAttributeProcessing {
|
||||||
|
|
||||||
applyDiscriminator( memberDetails, jaxbHbmAnyMapping, anyAnn, xmlDocumentContext );
|
applyDiscriminator( memberDetails, jaxbHbmAnyMapping, anyAnn, xmlDocumentContext );
|
||||||
applyKey( memberDetails, jaxbHbmAnyMapping, anyAnn, xmlDocumentContext );
|
applyKey( memberDetails, jaxbHbmAnyMapping, anyAnn, xmlDocumentContext );
|
||||||
|
XmlAnnotationHelper.applyCascading( jaxbHbmAnyMapping.getCascade(), memberDetails, xmlDocumentContext );
|
||||||
|
|
||||||
return memberDetails;
|
return memberDetails;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,11 +48,9 @@ public class OneToManyAttributeProcessing {
|
||||||
|
|
||||||
applyTargetEntity( jaxbOneToMany, oneToManyAnn, xmlDocumentContext );
|
applyTargetEntity( jaxbOneToMany, oneToManyAnn, xmlDocumentContext );
|
||||||
|
|
||||||
XmlAnnotationHelper.applyCascading( jaxbOneToMany.getCascade(), memberDetails, xmlDocumentContext );
|
|
||||||
|
|
||||||
CommonAttributeProcessing.applyAttributeBasics( jaxbOneToMany, memberDetails, oneToManyAnn, accessType, xmlDocumentContext );
|
CommonAttributeProcessing.applyAttributeBasics( jaxbOneToMany, memberDetails, oneToManyAnn, accessType, xmlDocumentContext );
|
||||||
|
|
||||||
CommonPluralAttributeProcessing.applyPluralAttributeStructure( jaxbOneToMany, memberDetails, xmlDocumentContext );
|
CommonPluralAttributeProcessing.applyPluralAttributeStructure( jaxbOneToMany, memberDetails, xmlDocumentContext );
|
||||||
|
XmlAnnotationHelper.applyCascading( jaxbOneToMany.getCascade(), memberDetails, xmlDocumentContext );
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// join-table
|
// join-table
|
||||||
|
|
|
@ -7,12 +7,16 @@
|
||||||
package org.hibernate.boot.models.xml.internal.attr;
|
package org.hibernate.boot.models.xml.internal.attr;
|
||||||
|
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbPluralAnyMappingImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbPluralAnyMappingImpl;
|
||||||
|
import org.hibernate.boot.models.xml.internal.XmlAnnotationHelper;
|
||||||
|
import org.hibernate.boot.models.xml.internal.XmlProcessingHelper;
|
||||||
import org.hibernate.boot.models.xml.spi.XmlDocumentContext;
|
import org.hibernate.boot.models.xml.spi.XmlDocumentContext;
|
||||||
import org.hibernate.models.spi.MutableClassDetails;
|
import org.hibernate.models.spi.MutableClassDetails;
|
||||||
import org.hibernate.models.spi.MutableMemberDetails;
|
import org.hibernate.models.spi.MutableMemberDetails;
|
||||||
|
|
||||||
import jakarta.persistence.AccessType;
|
import jakarta.persistence.AccessType;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.NullnessHelper.coalesce;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -21,9 +25,17 @@ public class PluralAnyMappingAttributeProcessing {
|
||||||
@SuppressWarnings("UnusedReturnValue")
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
public static MutableMemberDetails processPluralAnyMappingAttributes(
|
public static MutableMemberDetails processPluralAnyMappingAttributes(
|
||||||
JaxbPluralAnyMappingImpl jaxbHbmManyToAny,
|
JaxbPluralAnyMappingImpl jaxbHbmManyToAny,
|
||||||
MutableClassDetails mutableClassDetails,
|
MutableClassDetails declarer,
|
||||||
AccessType classAccessType,
|
AccessType classAccessType,
|
||||||
XmlDocumentContext xmlDocumentContext) {
|
XmlDocumentContext xmlDocumentContext) {
|
||||||
|
final AccessType accessType = coalesce( jaxbHbmManyToAny.getAccess(), classAccessType );
|
||||||
|
final MutableMemberDetails memberDetails = XmlProcessingHelper.getAttributeMember(
|
||||||
|
jaxbHbmManyToAny.getName(),
|
||||||
|
accessType,
|
||||||
|
declarer
|
||||||
|
);
|
||||||
|
XmlAnnotationHelper.applyCascading( jaxbHbmManyToAny.getCascade(), memberDetails, xmlDocumentContext );
|
||||||
|
|
||||||
throw new UnsupportedOperationException( "Support for many-to-any attributes not yet implemented" );
|
throw new UnsupportedOperationException( "Support for many-to-any attributes not yet implemented" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.hibernate.boot.jaxb.mapping.spi.JaxbPluralAttribute;
|
||||||
import org.hibernate.boot.jaxb.mapping.spi.JaxbUserTypeImpl;
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbUserTypeImpl;
|
||||||
import org.hibernate.boot.models.xml.internal.XmlAnnotationHelper;
|
import org.hibernate.boot.models.xml.internal.XmlAnnotationHelper;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.models.internal.dynamic.DynamicClassDetails;
|
import org.hibernate.models.internal.dynamic.DynamicClassDetails;
|
||||||
import org.hibernate.models.spi.ClassDetails;
|
import org.hibernate.models.spi.ClassDetails;
|
||||||
|
@ -47,10 +48,7 @@ public interface XmlDocumentContext {
|
||||||
*/
|
*/
|
||||||
XmlDocument getXmlDocument();
|
XmlDocument getXmlDocument();
|
||||||
|
|
||||||
/**
|
EffectiveMappingDefaults getEffectiveDefaults();
|
||||||
* The {@code <persistence-unit-metadata/>} defined by the XML document
|
|
||||||
*/
|
|
||||||
PersistenceUnitMetadata getPersistenceUnitMetadata();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to the containing SourceModelBuildingContext
|
* Access to the containing SourceModelBuildingContext
|
||||||
|
|
|
@ -24,8 +24,10 @@ public class XmlPreProcessor {
|
||||||
/**
|
/**
|
||||||
* Build an XmlResources reference based on the given {@code managedResources}
|
* Build an XmlResources reference based on the given {@code managedResources}
|
||||||
*/
|
*/
|
||||||
public static XmlPreProcessingResult preProcessXmlResources(ManagedResources managedResources) {
|
public static XmlPreProcessingResult preProcessXmlResources(
|
||||||
final XmlPreProcessingResultImpl collected = new XmlPreProcessingResultImpl();
|
ManagedResources managedResources,
|
||||||
|
PersistenceUnitMetadata persistenceUnitMetadata) {
|
||||||
|
final XmlPreProcessingResultImpl collected = new XmlPreProcessingResultImpl( persistenceUnitMetadata );
|
||||||
|
|
||||||
for ( Binding<JaxbBindableMappingDescriptor> mappingXmlBinding : managedResources.getXmlMappingBindings() ) {
|
for ( Binding<JaxbBindableMappingDescriptor> mappingXmlBinding : managedResources.getXmlMappingBindings() ) {
|
||||||
// for now skip hbm.xml
|
// for now skip hbm.xml
|
||||||
|
@ -33,7 +35,8 @@ public class XmlPreProcessor {
|
||||||
if ( root instanceof JaxbHbmHibernateMapping ) {
|
if ( root instanceof JaxbHbmHibernateMapping ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
collected.addDocument( (JaxbEntityMappingsImpl) root );
|
final JaxbEntityMappingsImpl jaxbEntityMappings = (JaxbEntityMappingsImpl) root;
|
||||||
|
collected.addDocument( jaxbEntityMappings );
|
||||||
}
|
}
|
||||||
|
|
||||||
return collected;
|
return collected;
|
||||||
|
|
|
@ -6,12 +6,14 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.models.xml.spi;
|
package org.hibernate.boot.models.xml.spi;
|
||||||
|
|
||||||
|
import org.hibernate.boot.internal.RootMappingDefaults;
|
||||||
import org.hibernate.boot.models.categorize.internal.DomainModelCategorizationCollector;
|
import org.hibernate.boot.models.categorize.internal.DomainModelCategorizationCollector;
|
||||||
import org.hibernate.boot.models.xml.internal.ManagedTypeProcessor;
|
import org.hibernate.boot.models.xml.internal.ManagedTypeProcessor;
|
||||||
import org.hibernate.boot.models.xml.internal.XmlDocumentContextImpl;
|
import org.hibernate.boot.models.xml.internal.XmlDocumentContextImpl;
|
||||||
import org.hibernate.boot.models.xml.internal.XmlDocumentImpl;
|
import org.hibernate.boot.models.xml.internal.XmlDocumentImpl;
|
||||||
import org.hibernate.boot.models.xml.internal.XmlProcessingResultImpl;
|
import org.hibernate.boot.models.xml.internal.XmlProcessingResultImpl;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.models.spi.SourceModelBuildingContext;
|
import org.hibernate.models.spi.SourceModelBuildingContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +27,8 @@ public class XmlProcessor {
|
||||||
XmlPreProcessingResult xmlPreProcessingResult,
|
XmlPreProcessingResult xmlPreProcessingResult,
|
||||||
DomainModelCategorizationCollector modelCategorizationCollector,
|
DomainModelCategorizationCollector modelCategorizationCollector,
|
||||||
SourceModelBuildingContext sourceModelBuildingContext,
|
SourceModelBuildingContext sourceModelBuildingContext,
|
||||||
BootstrapContext bootstrapContext) {
|
BootstrapContext bootstrapContext,
|
||||||
|
RootMappingDefaults mappingDefaults) {
|
||||||
final boolean xmlMappingsGloballyComplete = xmlPreProcessingResult.getPersistenceUnitMetadata().areXmlMappingsComplete();
|
final boolean xmlMappingsGloballyComplete = xmlPreProcessingResult.getPersistenceUnitMetadata().areXmlMappingsComplete();
|
||||||
final XmlProcessingResultImpl xmlOverlay = new XmlProcessingResultImpl();
|
final XmlProcessingResultImpl xmlOverlay = new XmlProcessingResultImpl();
|
||||||
|
|
||||||
|
@ -37,7 +40,7 @@ public class XmlProcessor {
|
||||||
);
|
);
|
||||||
final XmlDocumentContext xmlDocumentContext = new XmlDocumentContextImpl(
|
final XmlDocumentContext xmlDocumentContext = new XmlDocumentContextImpl(
|
||||||
xmlDocument,
|
xmlDocument,
|
||||||
xmlPreProcessingResult.getPersistenceUnitMetadata(),
|
mappingDefaults,
|
||||||
sourceModelBuildingContext,
|
sourceModelBuildingContext,
|
||||||
bootstrapContext
|
bootstrapContext
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||||
|
*/
|
||||||
|
package org.hibernate.boot.spi;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.CascadeType;
|
||||||
|
import org.hibernate.boot.jaxb.mapping.spi.JaxbEntityMappingsImpl;
|
||||||
|
import org.hibernate.boot.models.xml.spi.PersistenceUnitMetadata;
|
||||||
|
import org.hibernate.cache.spi.access.AccessType;
|
||||||
|
import org.hibernate.metamodel.CollectionClassification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defaults which are in effect for each mapping.
|
||||||
|
* A combination of global settings and XML-specific settings
|
||||||
|
*
|
||||||
|
* @see MappingDefaults
|
||||||
|
* @see PersistenceUnitMetadata
|
||||||
|
* @see JaxbEntityMappingsImpl
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public interface EffectiveMappingDefaults {
|
||||||
|
String DEFAULT_IDENTIFIER_COLUMN_NAME = "id";
|
||||||
|
String DEFAULT_TENANT_IDENTIFIER_COLUMN_NAME = "tenant_id";
|
||||||
|
String DEFAULT_DISCRIMINATOR_COLUMN_NAME = "class";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database catalog name to use
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#getImplicitCatalogName()
|
||||||
|
* @see PersistenceUnitMetadata#getDefaultCatalog()
|
||||||
|
*/
|
||||||
|
String getDefaultCatalogName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database schema name to use
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#getImplicitCatalogName()
|
||||||
|
* @see PersistenceUnitMetadata#getDefaultCatalog()
|
||||||
|
*/
|
||||||
|
String getDefaultSchemaName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether database identifiers be quoted by default
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#shouldImplicitlyQuoteIdentifiers()
|
||||||
|
* @see PersistenceUnitMetadata#useQuotedIdentifiers()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
boolean isDefaultQuoteIdentifiers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default column name to use for the identifier column if none specified in
|
||||||
|
* the mapping.
|
||||||
|
* Falls back to {@value #DEFAULT_IDENTIFIER_COLUMN_NAME}.
|
||||||
|
*/
|
||||||
|
String getDefaultIdColumnName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default column name to use for the discriminator column if none specified
|
||||||
|
* in the mapping.
|
||||||
|
* Falls back to {@value #DEFAULT_DISCRIMINATOR_COLUMN_NAME}.
|
||||||
|
*/
|
||||||
|
String getDefaultDiscriminatorColumnName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default column name to use for the tenant identifier column if none is
|
||||||
|
* specified in the mapping.
|
||||||
|
* Falls back to {@value #DEFAULT_TENANT_IDENTIFIER_COLUMN_NAME}.
|
||||||
|
*/
|
||||||
|
String getDefaultTenantIdColumnName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default package name to use if none specified in XML mappings.
|
||||||
|
* Useful when all (or most) domain classes are in a single package.
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#getImplicitPackageName()
|
||||||
|
* @see JaxbEntityMappingsImpl#getPackage()
|
||||||
|
*/
|
||||||
|
String getDefaultPackageName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether auto-importing of entity names (for queries) is enabled.
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#isAutoImportEnabled()
|
||||||
|
* @see JaxbEntityMappingsImpl#isAutoImport()
|
||||||
|
*/
|
||||||
|
boolean isDefaultAutoImport();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default cascade styles to apply to associations.
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#getImplicitCascadeStyleName()
|
||||||
|
* @see PersistenceUnitMetadata#getDefaultCascadeTypes()
|
||||||
|
* @see JaxbEntityMappingsImpl#getDefaultCascade()
|
||||||
|
*/
|
||||||
|
EnumSet<CascadeType> getDefaultCascadeTypes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default AccessType to use if not specified in the mapping.
|
||||||
|
*
|
||||||
|
* @see PersistenceUnitMetadata#getAccessType()
|
||||||
|
*/
|
||||||
|
jakarta.persistence.AccessType getDefaultPropertyAccessType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default {@link org.hibernate.property.access.spi.PropertyAccessStrategy} name to use if
|
||||||
|
* none specified in the mapping.
|
||||||
|
*
|
||||||
|
* @see #getDefaultPropertyAccessType
|
||||||
|
* @see MappingDefaults#getImplicitPropertyAccessorName()
|
||||||
|
* @see JaxbEntityMappingsImpl#getAttributeAccessor()
|
||||||
|
*/
|
||||||
|
String getDefaultAccessStrategyName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether singular associations (many-to-one, one-to-one) are lazy by default if not specified in the mapping.
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#areEntitiesImplicitlyLazy()
|
||||||
|
* @see JaxbEntityMappingsImpl#isDefaultLazy()
|
||||||
|
*/
|
||||||
|
boolean isDefaultEntityLaziness();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether plural attributes are lazy by default if not specified in the mapping.
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#areCollectionsImplicitlyLazy() ()
|
||||||
|
* @see JaxbEntityMappingsImpl#isDefaultLazy()
|
||||||
|
*/
|
||||||
|
boolean isDefaultCollectionLaziness();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default cache access strategy to use if none is specified
|
||||||
|
*
|
||||||
|
* @see MappingDefaults#getImplicitCacheAccessType()
|
||||||
|
*/
|
||||||
|
AccessType getDefaultCacheAccessType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated No longer supported
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
default CollectionClassification getDefaultListClassification() {
|
||||||
|
return CollectionClassification.LIST;
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,6 +31,8 @@ public interface MappingDefaults {
|
||||||
* Identifies the database schema name to use if none specified in the mapping.
|
* Identifies the database schema name to use if none specified in the mapping.
|
||||||
*
|
*
|
||||||
* @return The implicit schema name; may be {@code null}
|
* @return The implicit schema name; may be {@code null}
|
||||||
|
*
|
||||||
|
* @see org.hibernate.cfg.MappingSettings#DEFAULT_SCHEMA
|
||||||
*/
|
*/
|
||||||
String getImplicitSchemaName();
|
String getImplicitSchemaName();
|
||||||
|
|
||||||
|
@ -38,6 +40,8 @@ public interface MappingDefaults {
|
||||||
* Identifies the database catalog name to use if none specified in the mapping.
|
* Identifies the database catalog name to use if none specified in the mapping.
|
||||||
*
|
*
|
||||||
* @return The implicit catalog name; may be {@code null}
|
* @return The implicit catalog name; may be {@code null}
|
||||||
|
*
|
||||||
|
* @see org.hibernate.cfg.MappingSettings#DEFAULT_CATALOG
|
||||||
*/
|
*/
|
||||||
String getImplicitCatalogName();
|
String getImplicitCatalogName();
|
||||||
|
|
||||||
|
@ -99,10 +103,7 @@ public interface MappingDefaults {
|
||||||
String getImplicitCascadeStyleName();
|
String getImplicitCascadeStyleName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies the default {@link org.hibernate.property.access.spi.PropertyAccessStrategy} name to use if none specified in the
|
* The default {@link org.hibernate.property.access.spi.PropertyAccessStrategy} to use if none specified in the mapping.
|
||||||
* mapping.
|
|
||||||
*
|
|
||||||
* @return The implicit property accessor name
|
|
||||||
*
|
*
|
||||||
* @see org.hibernate.property.access.spi.PropertyAccessStrategy
|
* @see org.hibernate.property.access.spi.PropertyAccessStrategy
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -39,7 +39,7 @@ public interface MetadataBuildingContext {
|
||||||
*
|
*
|
||||||
* @return The mapping defaults.
|
* @return The mapping defaults.
|
||||||
*/
|
*/
|
||||||
MappingDefaults getMappingDefaults();
|
EffectiveMappingDefaults getEffectiveDefaults();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to the collector of metadata as we build it.
|
* Access to the collector of metadata as we build it.
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.hibernate.boot.internal.BootstrapContextImpl;
|
||||||
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
||||||
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
||||||
import org.hibernate.boot.internal.MetadataBuildingContextRootImpl;
|
import org.hibernate.boot.internal.MetadataBuildingContextRootImpl;
|
||||||
|
import org.hibernate.boot.internal.RootMappingDefaults;
|
||||||
import org.hibernate.boot.model.process.spi.ManagedResources;
|
import org.hibernate.boot.model.process.spi.ManagedResources;
|
||||||
import org.hibernate.boot.model.process.spi.MetadataBuildingProcess;
|
import org.hibernate.boot.model.process.spi.MetadataBuildingProcess;
|
||||||
import org.hibernate.boot.models.bind.internal.BindingContextImpl;
|
import org.hibernate.boot.models.bind.internal.BindingContextImpl;
|
||||||
|
@ -54,11 +55,17 @@ public class BindingTestingHelper {
|
||||||
bootstrapContext
|
bootstrapContext
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final RootMappingDefaults mappingDefaults = new RootMappingDefaults(
|
||||||
|
new MetadataBuilderImpl.MappingDefaultsImpl( serviceRegistry ),
|
||||||
|
metadataCollector.getPersistenceUnitMetadata()
|
||||||
|
);
|
||||||
|
|
||||||
final MetadataBuildingContextRootImpl metadataBuildingContext = new MetadataBuildingContextRootImpl(
|
final MetadataBuildingContextRootImpl metadataBuildingContext = new MetadataBuildingContextRootImpl(
|
||||||
"models",
|
"models",
|
||||||
bootstrapContext,
|
bootstrapContext,
|
||||||
bootstrapContext.getMetadataBuildingOptions(),
|
bootstrapContext.getMetadataBuildingOptions(),
|
||||||
metadataCollector
|
metadataCollector,
|
||||||
|
mappingDefaults
|
||||||
);
|
);
|
||||||
final BindingStateImpl bindingState = new BindingStateImpl( metadataBuildingContext );
|
final BindingStateImpl bindingState = new BindingStateImpl( metadataBuildingContext );
|
||||||
final BindingOptionsImpl bindingOptions = new BindingOptionsImpl( metadataBuildingContext );
|
final BindingOptionsImpl bindingOptions = new BindingOptionsImpl( metadataBuildingContext );
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||||
import org.hibernate.boot.MetadataSources;
|
import org.hibernate.boot.MetadataSources;
|
||||||
import org.hibernate.boot.internal.BootstrapContextImpl;
|
import org.hibernate.boot.internal.BootstrapContextImpl;
|
||||||
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
||||||
|
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
||||||
import org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl;
|
import org.hibernate.boot.internal.MetadataBuilderImpl.MetadataBuildingOptionsImpl;
|
||||||
import org.hibernate.boot.model.process.spi.ManagedResources;
|
import org.hibernate.boot.model.process.spi.ManagedResources;
|
||||||
import org.hibernate.boot.model.process.spi.MetadataBuildingProcess;
|
import org.hibernate.boot.model.process.spi.MetadataBuildingProcess;
|
||||||
|
@ -53,7 +54,8 @@ public class AttributeOverrideXmlTests {
|
||||||
final DomainModelSource domainModelSource = processManagedResources(
|
final DomainModelSource domainModelSource = processManagedResources(
|
||||||
managedResources,
|
managedResources,
|
||||||
metadataCollector,
|
metadataCollector,
|
||||||
bootstrapContext
|
bootstrapContext,
|
||||||
|
new MetadataBuilderImpl.MappingDefaultsImpl( registry )
|
||||||
);
|
);
|
||||||
|
|
||||||
final ClassDetailsRegistry classDetailsRegistry = domainModelSource.getClassDetailsRegistry();
|
final ClassDetailsRegistry classDetailsRegistry = domainModelSource.getClassDetailsRegistry();
|
||||||
|
|
|
@ -6,8 +6,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.orm.test.jpa.mapping;
|
package org.hibernate.orm.test.jpa.mapping;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
||||||
import java.util.List;
|
import org.hibernate.testing.orm.junit.Jpa;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
@ -15,15 +17,6 @@ import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
|
||||||
|
|
||||||
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
|
||||||
import org.hibernate.testing.orm.junit.Jpa;
|
|
||||||
import org.hibernate.testing.orm.junit.SettingProvider;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
|
@ -32,12 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
DefaultCascadeTest.Parent.class,
|
DefaultCascadeTest.Parent.class,
|
||||||
DefaultCascadeTest.Child.class
|
DefaultCascadeTest.Child.class
|
||||||
},
|
},
|
||||||
// using 'xmlMappings = { "org/hibernate/orm/test/jpa/mapping/orm.xml" }' also works
|
xmlMappings = "org/hibernate/orm/test/jpa/mapping/orm.xml"
|
||||||
settingProviders = {
|
|
||||||
@SettingProvider(
|
|
||||||
settingName = AvailableSettings.ORM_XML_FILES,
|
|
||||||
provider = DefaultCascadeTest.EJB3DDMappingProvider.class )
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
public class DefaultCascadeTest {
|
public class DefaultCascadeTest {
|
||||||
|
|
||||||
|
@ -85,10 +73,4 @@ public class DefaultCascadeTest {
|
||||||
private Parent parent;
|
private Parent parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EJB3DDMappingProvider implements SettingProvider.Provider<List<String>> {
|
|
||||||
@Override
|
|
||||||
public List<String> getSetting() {
|
|
||||||
return Arrays.asList( "org/hibernate/orm/test/jpa/mapping/orm.xml" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class EnversMetadataBuildingContextImpl implements EnversMetadataBuilding
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingDefaults getMappingDefaults() {
|
public MappingDefaults getEffectiveDefaults() {
|
||||||
return metadataCollector.getMetadataBuildingOptions().getMappingDefaults();
|
return metadataCollector.getMetadataBuildingOptions().getMappingDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,13 @@ package org.hibernate.testing.boot;
|
||||||
import org.hibernate.boot.internal.BootstrapContextImpl;
|
import org.hibernate.boot.internal.BootstrapContextImpl;
|
||||||
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
||||||
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
||||||
|
import org.hibernate.boot.internal.RootMappingDefaults;
|
||||||
import org.hibernate.boot.model.TypeDefinitionRegistryStandardImpl;
|
import org.hibernate.boot.model.TypeDefinitionRegistryStandardImpl;
|
||||||
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
|
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
|
||||||
|
import org.hibernate.boot.models.xml.internal.PersistenceUnitMetadataImpl;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||||
import org.hibernate.boot.spi.MappingDefaults;
|
import org.hibernate.boot.spi.MappingDefaults;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
|
@ -23,7 +26,7 @@ import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
*/
|
*/
|
||||||
public class MetadataBuildingContextTestingImpl implements MetadataBuildingContext {
|
public class MetadataBuildingContextTestingImpl implements MetadataBuildingContext {
|
||||||
private final MetadataBuildingOptions buildingOptions;
|
private final MetadataBuildingOptions buildingOptions;
|
||||||
private final MappingDefaults mappingDefaults;
|
private final EffectiveMappingDefaults mappingDefaults;
|
||||||
private final InFlightMetadataCollector metadataCollector;
|
private final InFlightMetadataCollector metadataCollector;
|
||||||
private final BootstrapContext bootstrapContext;
|
private final BootstrapContext bootstrapContext;
|
||||||
private final ObjectNameNormalizer objectNameNormalizer;
|
private final ObjectNameNormalizer objectNameNormalizer;
|
||||||
|
@ -33,7 +36,10 @@ public class MetadataBuildingContextTestingImpl implements MetadataBuildingConte
|
||||||
MetadataBuilderImpl.MetadataBuildingOptionsImpl buildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl( serviceRegistry );
|
MetadataBuilderImpl.MetadataBuildingOptionsImpl buildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl( serviceRegistry );
|
||||||
this.buildingOptions = buildingOptions;
|
this.buildingOptions = buildingOptions;
|
||||||
buildingOptions.setBootstrapContext( bootstrapContext = new BootstrapContextImpl( serviceRegistry, buildingOptions ) );
|
buildingOptions.setBootstrapContext( bootstrapContext = new BootstrapContextImpl( serviceRegistry, buildingOptions ) );
|
||||||
mappingDefaults = new MetadataBuilderImpl.MappingDefaultsImpl( serviceRegistry );
|
mappingDefaults = new RootMappingDefaults(
|
||||||
|
new MetadataBuilderImpl.MappingDefaultsImpl( serviceRegistry ),
|
||||||
|
new PersistenceUnitMetadataImpl()
|
||||||
|
);
|
||||||
metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, buildingOptions );
|
metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext, buildingOptions );
|
||||||
objectNameNormalizer = new ObjectNameNormalizer() {
|
objectNameNormalizer = new ObjectNameNormalizer() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,7 +62,7 @@ public class MetadataBuildingContextTestingImpl implements MetadataBuildingConte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MappingDefaults getMappingDefaults() {
|
public EffectiveMappingDefaults getEffectiveDefaults() {
|
||||||
return mappingDefaults;
|
return mappingDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||||
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
import org.hibernate.boot.spi.BootstrapContext;
|
||||||
|
import org.hibernate.boot.spi.EffectiveMappingDefaults;
|
||||||
import org.hibernate.boot.spi.MappingDefaults;
|
import org.hibernate.boot.spi.MappingDefaults;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||||
|
@ -783,6 +784,11 @@ public abstract class MockSessionFactory
|
||||||
return new MockMappingDefaults();
|
return new MockMappingDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EffectiveMappingDefaults getEffectiveDefaults() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy() {
|
public TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy() {
|
||||||
return TimeZoneStorageStrategy.NATIVE;
|
return TimeZoneStorageStrategy.NATIVE;
|
||||||
|
|
Loading…
Reference in New Issue