Class RelationalMappingContext
java.lang.Object
org.springframework.data.mapping.context.AbstractMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>
org.springframework.data.relational.core.mapping.RelationalMappingContext
- All Implemented Interfaces:
Aware, BeanFactoryAware, InitializingBean, ApplicationContextAware, ApplicationEventPublisherAware, EnvironmentAware, MappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>
public class RelationalMappingContext
extends AbstractMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>
MappingContext implementation.- Author:
- Jens Schauder, Greg Turnquist, Kazuki Shimizu, Oliver Gierke, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newRelationalMappingContext.RelationalMappingContext(NamingStrategy namingStrategy) Creates a newRelationalMappingContextusing the givenNamingStrategy. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyDefaults(BasicRelationalPersistentProperty persistentProperty) protected <T> RelationalPersistentEntity<T> createPersistentEntity(org.springframework.data.core.TypeInformation<T> typeInformation) protected RelationalPersistentPropertycreatePersistentProperty(Property property, RelationalPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) getAggregatePath(PersistentPropertyPath<? extends RelationalPersistentProperty> path) Provides anAggregatePathfor the providedPersistentPropertyPath.@Nullable RelationalPersistentEntity<?> getPersistentEntity(RelationalPersistentProperty persistentProperty) booleanReturn whether quoting should be enabled for all table and column names.booleanvoidsetApplicationContext(ApplicationContext applicationContext) voidsetEnvironment(Environment environment) voidsetForceQuote(boolean forceQuote) Enable/disable quoting for all tables and column names.voidsetSingleQueryLoadingEnabled(boolean singleQueryLoadingEnabled) Set the singleQueryLoadingEnabled flag.voidsetSqlIdentifierSanitizer(SqlIdentifierSanitizer sanitizer) Set theSqlIdentifierSanitizerto sanitizeidentifierscreated from SpEL expressions.Methods inherited from class AbstractMappingContext
addPersistentEntity, addPersistentEntity, afterPropertiesSet, doFindPersistentPropertyPaths, findPersistentPropertyPaths, getManagedTypes, getPersistentEntities, getPersistentEntity, getPersistentEntity, getPersistentPropertyPath, getPersistentPropertyPath, getPersistentPropertyPath, hasPersistentEntityFor, initialize, setApplicationEventPublisher, setBeanFactory, setInitialEntitySet, setManagedTypes, setSimpleTypeHolder, setStrict, shouldCreatePersistentEntityFor, shouldCreatePropertiesMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MappingContext
getRequiredPersistentEntity, getRequiredPersistentEntity, getRequiredPersistentEntity
-
Constructor Details
-
RelationalMappingContext
public RelationalMappingContext()Creates a newRelationalMappingContext. -
RelationalMappingContext
Creates a newRelationalMappingContextusing the givenNamingStrategy.- Parameters:
namingStrategy- must not be null.
-
-
Method Details
-
isForceQuote
public boolean isForceQuote()Return whether quoting should be enabled for all table and column names. Quoting is enabled by default.- Returns:
- Since:
- 2.0
-
setForceQuote
public void setForceQuote(boolean forceQuote) Enable/disable quoting for all tables and column names.- Parameters:
forceQuote-
-
setSqlIdentifierSanitizer
Set theSqlIdentifierSanitizerto sanitizeidentifierscreated from SpEL expressions.- Parameters:
sanitizer- must not be null.- Since:
- 3.2
-
getNamingStrategy
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Overrides:
setApplicationContextin classAbstractMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>- Throws:
BeansException
-
setEnvironment
- Specified by:
setEnvironmentin interfaceEnvironmentAware- Overrides:
setEnvironmentin classAbstractMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>
-
getPersistentEntity
public @Nullable RelationalPersistentEntity<?> getPersistentEntity(RelationalPersistentProperty persistentProperty) - Specified by:
getPersistentEntityin interfaceMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>- Overrides:
getPersistentEntityin classAbstractMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>
-
createPersistentEntity
protected <T> RelationalPersistentEntity<T> createPersistentEntity(org.springframework.data.core.TypeInformation<T> typeInformation) - Specified by:
createPersistentEntityin classAbstractMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>
-
createPersistentProperty
protected RelationalPersistentProperty createPersistentProperty(Property property, RelationalPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) - Specified by:
createPersistentPropertyin classAbstractMappingContext<RelationalPersistentEntity<?>, RelationalPersistentProperty>
-
isSingleQueryLoadingEnabled
public boolean isSingleQueryLoadingEnabled()- Returns:
- iff single query loading is enabled.
- Since:
- 3.2
- See Also:
-
setSingleQueryLoadingEnabled
public void setSingleQueryLoadingEnabled(boolean singleQueryLoadingEnabled) Set the singleQueryLoadingEnabled flag. If it is set to true and theDialectsupports it, Spring Data JDBC will try to use Single Query Loading if possible.- Parameters:
singleQueryLoadingEnabled-- Since:
- 3.2
-
applyDefaults
-
getAggregatePath
public AggregatePath getAggregatePath(PersistentPropertyPath<? extends RelationalPersistentProperty> path) Provides anAggregatePathfor the providedPersistentPropertyPath.- Parameters:
path- the path to provide anAggregatePathfor. Must not be null.- Returns:
- an
AggregatePathon the provided path. - Since:
- 3.2
-
getAggregatePath
-