Class HibernateOrmMapping
java.lang.Object
org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingImplementor<HibernateOrmMapping>
org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmMapping
- All Implemented Interfaces:
AutoCloseable,BackendMappingContext,MappingImplementor<HibernateOrmMapping>,AutomaticIndexingMappingContext,HibernateOrmListenerContextProvider,HibernateOrmLoadingMappingContext,HibernateOrmMappingContext,SearchMapping,CoordinationStrategyContext,HibernateOrmMassIndexingMappingContext,HibernateOrmScopeMappingContext,SearchScopeProvider,HibernateOrmSearchSessionMappingContext,BatchMappingContext,BridgeMappingContext,PojoMassIndexingMappingContext,PojoScopeMappingContext,PojoSearchSessionMappingContext,PojoWorkMappingContext
public class HibernateOrmMapping
extends AbstractPojoMappingImplementor<HibernateOrmMapping>
implements SearchMapping, AutoCloseable, HibernateOrmMappingContext, HibernateOrmListenerContextProvider, BatchMappingContext, HibernateOrmScopeMappingContext, HibernateOrmSearchSessionMappingContext, AutomaticIndexingMappingContext, CoordinationStrategyContext
-
Method Summary
Modifier and TypeMethodDescriptionbackend()voidclose()create(PojoMappingDelegate mappingDelegate, org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmTypeContextContainer typeContextContainer, BeanHolder<? extends CoordinationStrategy> coordinationStrategyHolder, ConfiguredAutomaticIndexingStrategy configuredAutomaticIndexingStrategy, SessionFactoryImplementor sessionFactory, ConfigurationPropertySource propertySource) Creates aPojoMassIndexerAgent, able to exert control over other agents that could perform indexing concurrently (e.g. indexing plans).<T> SearchScopeImpl<T>createScope(Class<T> expectedSuperType, Collection<String> entityNames) <T> SearchScopeImpl<T>createScope(Collection<? extends Class<? extends T>> classes) createSessionBuilder(SessionImplementor sessionImplementor) currentIndexingPlanIfTypeIncluded(SessionImplementor session, PojoRawTypeIdentifier<?> typeIdentifier) protected voiddoStop()inthints()<E> SearchIndexedEntity<E>indexedEntity(Class<E> entityType) indexedEntity(String entityName) voidSet a filter defining which types must be included/excluded when indexed within indexing plans (either automatically or manually).indexManager(String indexName) booleanvoidlistenerEnabled(boolean enabled) preStop(MappingPreStopContext context) Prepare forMappingImplementor.stop(), executing any operations that needs to be executed before shutdown.<T> SearchScopeImpl<T>Creates aSearchScopelimited to indexed entity types among the given class and its subtypes.<T> SearchScopeImpl<T>Creates aSearchScopelimited to indexed entity types among the entity with the given name and its subtypes.<T> SearchScopeImpl<T>scope(Class<T> expectedSuperType, Collection<String> entityNames) Creates aSearchScopelimited to indexed entity types among the entities with the given names and their subtypes.<T> SearchScopeImpl<T>scope(Collection<? extends Class<? extends T>> classes) Creates aSearchScopelimited to indexed entity types among the given classes and their subtypes.sessionContext(EntityManager entityManager) start(MappingStartContext context) Start any resource necessary to operate the mapping at runtime.org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmTypeContextContainerMethods inherited from class org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingImplementor
createIndexer, createIndexingPlan, createIndexingPlan, createIndexingQueueEventProcessingPlan, delegate, entityReferenceFactory, entityReferenceFactoryDelegate, failureHandler, identifierBridgeToDocumentIdentifierContext, mappedTypeContext, projectionRegistry, stop, threadPoolProvider, toDocumentValueConvertContext, typeIdentifierResolver, valueBridgeToIndexedValueContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.search.mapper.orm.automaticindexing.spi.AutomaticIndexingMappingContext
entityReferenceFactory, failureHandlerMethods inherited from interface org.hibernate.search.engine.backend.mapping.spi.BackendMappingContext
entityReferenceFactory, mappedTypeContext, projectionRegistry, toDocumentValueConvertContextMethods inherited from interface org.hibernate.search.mapper.pojo.bridge.runtime.spi.BridgeMappingContext
identifierBridgeToDocumentIdentifierContext, valueBridgeToIndexedValueContextMethods inherited from interface org.hibernate.search.mapper.orm.session.impl.HibernateOrmSearchSessionMappingContext
failureHandlerMethods inherited from interface org.hibernate.search.mapper.pojo.massindexing.spi.PojoMassIndexingMappingContext
entityReferenceFactoryDelegate, threadPoolProviderMethods inherited from interface org.hibernate.search.mapper.pojo.scope.spi.PojoScopeMappingContext
entityReferenceFactoryDelegate, typeIdentifierResolverMethods inherited from interface org.hibernate.search.mapper.pojo.session.spi.PojoSearchSessionMappingContext
createIndexer, createIndexingPlan, createIndexingPlan, createIndexingQueueEventProcessingPlanMethods inherited from interface org.hibernate.search.mapper.orm.mapping.SearchMapping
extension
-
Method Details
-
create
public static MappingImplementor<HibernateOrmMapping> create(PojoMappingDelegate mappingDelegate, org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmTypeContextContainer typeContextContainer, BeanHolder<? extends CoordinationStrategy> coordinationStrategyHolder, ConfiguredAutomaticIndexingStrategy configuredAutomaticIndexingStrategy, SessionFactoryImplementor sessionFactory, ConfigurationPropertySource propertySource) -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
start
Description copied from interface:MappingImplementorStart any resource necessary to operate the mapping at runtime.Called by the engine once during bootstrap, after backends and index managers were started.
- Specified by:
startin interfaceMappingImplementor<HibernateOrmMapping>- Overrides:
startin classAbstractPojoMappingImplementor<HibernateOrmMapping>- Parameters:
context- The start context.- Returns:
- A future that completes when the mapper is completely started.
-
preStop
Description copied from interface:MappingImplementorPrepare forMappingImplementor.stop(), executing any operations that needs to be executed before shutdown.- Specified by:
preStopin interfaceMappingImplementor<HibernateOrmMapping>- Overrides:
preStopin classAbstractPojoMappingImplementor<HibernateOrmMapping>- Parameters:
context- The pre-stop context.- Returns:
- A future that completes when pre-stop operations complete.
-
doStop
protected void doStop()- Overrides:
doStopin classAbstractPojoMappingImplementor<HibernateOrmMapping>
-
hints
- Specified by:
hintsin interfaceBackendMappingContext- Overrides:
hintsin classAbstractPojoMappingImplementor<HibernateOrmMapping>
-
scope
Description copied from interface:SearchScopeProviderCreates aSearchScopelimited to indexed entity types among the given class and its subtypes.- Specified by:
scopein interfaceBatchMappingContext- Specified by:
scopein interfaceSearchScopeProvider- Type Parameters:
T- A supertype of all indexed entity types to include in the scope.- Parameters:
clazz- A class that must be an indexed entity type or a supertype of such type.- Returns:
- The created scope.
- See Also:
-
scope
Description copied from interface:SearchScopeProviderCreates aSearchScopelimited to indexed entity types among the entity with the given name and its subtypes.- Specified by:
scopein interfaceBatchMappingContext- Specified by:
scopein interfaceSearchScopeProvider- Type Parameters:
T- A supertype of all indexed entity types to include in the scope.- Parameters:
expectedSuperType- A supertype of all entity types to include in the scope.entityName- An entity name. SeeEntity.name(). The referenced entity type must be an indexed entity type or a supertype of such type.- Returns:
- The created scope.
- See Also:
-
scope
Description copied from interface:SearchScopeProviderCreates aSearchScopelimited to indexed entity types among the given classes and their subtypes.- Specified by:
scopein interfaceBatchMappingContext- Specified by:
scopein interfaceSearchScopeProvider- Type Parameters:
T- A supertype of all indexed entity types to include in the scope.- Parameters:
classes- A collection of classes. Each must be an indexed entity type or a supertype of such type.- Returns:
- The created scope.
- See Also:
-
scope
Description copied from interface:SearchScopeProviderCreates aSearchScopelimited to indexed entity types among the entities with the given names and their subtypes.- Specified by:
scopein interfaceSearchScopeProvider- Type Parameters:
T- A supertype of all indexed entity types to include in the scope.- Parameters:
expectedSuperType- A supertype of all indexed entity types to include in the scope.entityNames- A collection of entity names. SeeEntity.name(). Each entity type referenced in the collection must be an indexed entity type or a supertype of such type.- Returns:
- The created scope.
- See Also:
-
toEntityManagerFactory
- Specified by:
toEntityManagerFactoryin interfaceSearchMapping- Returns:
- The underlying
EntityManagerFactoryused by thisSearchMapping.
-
toOrmSessionFactory
- Specified by:
toOrmSessionFactoryin interfaceSearchMapping- Returns:
- The underlying
SessionFactoryused by thisSearchMapping.
-
indexedEntity
- Specified by:
indexedEntityin interfaceSearchMapping- Type Parameters:
E- The type of an indexed entity.- Parameters:
entityType- The type of an indexed entity. This must be the exact type; passing the type of a mapped-superclass for example will not work.- Returns:
- A
SearchIndexedEntityfor the indexed entity with the exact given type.
-
indexedEntity
- Specified by:
indexedEntityin interfaceSearchMapping- Parameters:
entityName- The name of an indexed entity. SeeEntity.name().- Returns:
- A
SearchIndexedEntityfor the indexed entity with the given name.
-
allIndexedEntities
- Specified by:
allIndexedEntitiesin interfaceSearchMapping- Returns:
- A collection containing one
SearchIndexedEntityfor each indexed entity
-
indexManager
- Specified by:
indexManagerin interfaceSearchMapping- Parameters:
indexName- The name of an index. SeeIndexed.index().- Returns:
- The index manager for the index having
indexNameas name.
-
backend
- Specified by:
backendin interfaceSearchMapping- Returns:
- The default backend, if any.
-
backend
- Specified by:
backendin interfaceSearchMapping- Parameters:
backendName- The name of a backend. SeeIndexed.backend().- Returns:
- The backend having
backendNameas name.
-
indexingPlanFilter
Description copied from interface:SearchMappingSet a filter defining which types must be included/excluded when indexed within indexing plans (either automatically or manually).This does not affect indexing that does not rely on indexing plans, like the mass indexer.
By default, all indexed and contained types are included.
- Specified by:
indexingPlanFilterin interfaceSearchMapping- Parameters:
filter- The filter that includes/excludes types when indexed.
-
applicationIndexingPlanFilter
- Specified by:
applicationIndexingPlanFilterin interfaceHibernateOrmSearchSessionMappingContext
-
configuredSearchIndexingPlanFilter
public ConfiguredSearchIndexingPlanFilter configuredSearchIndexingPlanFilter(SearchIndexingPlanFilter filter) - Specified by:
configuredSearchIndexingPlanFilterin interfaceHibernateOrmSearchSessionMappingContext
-
toConcreteType
- Specified by:
toConcreteTypein interfaceMappingImplementor<HibernateOrmMapping>
-
cacheLookupStrategy
- Specified by:
cacheLookupStrategyin interfaceHibernateOrmLoadingMappingContext
-
fetchSize
public int fetchSize()- Specified by:
fetchSizein interfaceHibernateOrmLoadingMappingContext
-
sessionFactory
- Specified by:
sessionFactoryin interfaceAutomaticIndexingMappingContext- Specified by:
sessionFactoryin interfaceHibernateOrmLoadingMappingContext- Specified by:
sessionFactoryin interfaceHibernateOrmMappingContext- Returns:
- The Hibernate ORM
SessionFactory.
-
tenancyConfiguration
- Specified by:
tenancyConfigurationin interfaceAutomaticIndexingMappingContext- Specified by:
tenancyConfigurationin interfaceBatchMappingContext- Specified by:
tenancyConfigurationin interfaceHibernateOrmMassIndexingMappingContext
-
massIndexingDefaultCleanOperation
- Specified by:
massIndexingDefaultCleanOperationin interfaceBatchMappingContext- Specified by:
massIndexingDefaultCleanOperationin interfaceHibernateOrmMassIndexingMappingContext
-
sessionContext
- Specified by:
sessionContextin interfaceBatchMappingContext- Specified by:
sessionContextin interfaceHibernateOrmLoadingMappingContext- Specified by:
sessionContextin interfaceHibernateOrmScopeMappingContext
-
listenerEnabled
public boolean listenerEnabled()- Specified by:
listenerEnabledin interfaceHibernateOrmListenerContextProvider
-
listenerEnabled
public void listenerEnabled(boolean enabled) -
backgroundIndexingCompletion
-
createMassIndexerAgent
Description copied from interface:PojoMassIndexingMappingContextCreates aPojoMassIndexerAgent, able to exert control over other agents that could perform indexing concurrently (e.g. indexing plans).- Specified by:
createMassIndexerAgentin interfacePojoMassIndexingMappingContext- Parameters:
context- A context with information about the mass indexing that is about to start.- Returns:
- An agent.
-
currentIndexingPlanIfExisting
- Specified by:
currentIndexingPlanIfExistingin interfaceHibernateOrmListenerContextProvider
-
currentIndexingPlanIfTypeIncluded
public PojoTypeIndexingPlan currentIndexingPlanIfTypeIncluded(SessionImplementor session, PojoRawTypeIdentifier<?> typeIdentifier) - Specified by:
currentIndexingPlanIfTypeIncludedin interfaceHibernateOrmListenerContextProvider
-
createIndexingQueueEventProcessingPlan
public AutomaticIndexingQueueEventProcessingPlan createIndexingQueueEventProcessingPlan(Session session) - Specified by:
createIndexingQueueEventProcessingPlanin interfaceAutomaticIndexingMappingContext- Parameters:
session- A Hibernate ORMSessioncreated from the sameAutomaticIndexingMappingContext.sessionFactory()as this mapping.- Returns:
- An event processing plan for the given session.
It will not get executed automatically: you need to call
AutomaticIndexingQueueEventProcessingPlan.executeAndReport(OperationSubmitter), which is asynchronous and returns a future.
-
currentAutomaticIndexingSynchronizationStrategy
public ConfiguredIndexingPlanSynchronizationStrategy currentAutomaticIndexingSynchronizationStrategy(SessionImplementor session) - Specified by:
currentAutomaticIndexingSynchronizationStrategyin interfaceHibernateOrmListenerContextProvider
-
typeContextProvider
public org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmTypeContextContainer typeContextProvider()- Specified by:
typeContextProviderin interfaceBatchMappingContext- Specified by:
typeContextProviderin interfaceHibernateOrmListenerContextProvider
-
createScope
- Specified by:
createScopein interfaceHibernateOrmSearchSessionMappingContext
-
createScope
public <T> SearchScopeImpl<T> createScope(Class<T> expectedSuperType, Collection<String> entityNames) - Specified by:
createScopein interfaceHibernateOrmSearchSessionMappingContext
-
createSessionBuilder
public HibernateOrmSearchSession.Builder createSessionBuilder(SessionImplementor sessionImplementor) - Specified by:
createSessionBuilderin interfaceHibernateOrmSearchSessionMappingContext
-
coordinationStrategy
- Specified by:
coordinationStrategyin interfaceCoordinationStrategyContext
-