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,LoadingMappingContext,HibernateOrmMappingContext,SearchMapping,CoordinationStrategyContext,HibernateOrmMassIndexingMappingContext,HibernateOrmScopeMappingContext,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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<SearchIndexedEntity<?>>allIndexedEntities()ConfiguredSearchIndexingPlanFilterapplicationIndexingPlanFilter()Backendbackend()Backendbackend(String backendName)CompletableFuture<?>backgroundIndexingCompletion()EntityLoadingCacheLookupStrategycacheLookupStrategy()voidclose()ConfiguredSearchIndexingPlanFilterconfiguredSearchIndexingPlanFilter(SearchIndexingPlanFilter filter)CoordinationStrategycoordinationStrategy()static MappingImplementor<HibernateOrmMapping>create(PojoMappingDelegate mappingDelegate, org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmTypeContextContainer typeContextContainer, BeanHolder<? extends CoordinationStrategy> coordinationStrategyHolder, ConfiguredAutomaticIndexingStrategy configuredAutomaticIndexingStrategy, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, ConfigurationPropertySource propertySource)AutomaticIndexingQueueEventProcessingPlancreateIndexingQueueEventProcessingPlan(org.hibernate.Session session)PojoMassIndexerAgentcreateMassIndexerAgent(PojoMassIndexerAgentCreateContext context)Creates aPojoMassIndexerAgent, able to exert control over other agents that could perform indexing concurrently (e.g.<T> SearchScopeImpl<T>createScope(Class<T> expectedSuperType, Collection<String> entityNames)<T> SearchScopeImpl<T>createScope(Collection<? extends Class<? extends T>> classes)HibernateOrmSearchSession.BuildercreateSessionBuilder(org.hibernate.engine.spi.SessionImplementor sessionImplementor)ConfiguredIndexingPlanSynchronizationStrategycurrentAutomaticIndexingSynchronizationStrategy(org.hibernate.engine.spi.SessionImplementor session)PojoIndexingPlancurrentIndexingPlanIfExisting(org.hibernate.engine.spi.SessionImplementor session)PojoTypeIndexingPlancurrentIndexingPlanIfTypeIncluded(org.hibernate.engine.spi.SessionImplementor session, PojoRawTypeIdentifier<?> typeIdentifier)protected voiddoStop()intfetchSize()BackendMappingHintshints()<E> SearchIndexedEntity<E>indexedEntity(Class<E> entityType)SearchIndexedEntity<?>indexedEntity(String entityName)voidindexingPlanFilter(SearchIndexingPlanFilter filter)Set a filter defining which types must be included/excluded when indexed within indexing plans (either automatically or manually).IndexManagerindexManager(String indexName)booleanlistenerEnabled()voidlistenerEnabled(boolean enabled)ProjectionMappedTypeContextmappedTypeContext(String mappedTypeName)CompletableFuture<?>preStop(MappingPreStopContext context)Prepare forMappingImplementor.stop(), executing any operations that needs to be executed before shutdown.<T> SearchScope<T>scope(Class<T> expectedSuperType, Collection<String> entityNames)Create aSearchScopelimited to entity types referenced by their name.<T> SearchScope<T>scope(Collection<? extends Class<? extends T>> types)Create aSearchScopelimited to the given types.HibernateOrmScopeSessionContextsessionContext(EntityManager entityManager)org.hibernate.engine.spi.SessionFactoryImplementorsessionFactory()CompletableFuture<?>start(MappingStartContext context)Start any resource necessary to operate the mapping at runtime.HibernateOrmMappingtoConcreteType()EntityManagerFactorytoEntityManagerFactory()org.hibernate.SessionFactorytoOrmSessionFactory()org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmTypeContextContainertypeContextProvider()-
Methods inherited from class org.hibernate.search.mapper.pojo.mapping.spi.AbstractPojoMappingImplementor
createIndexer, createIndexingPlan, createIndexingPlan, createIndexingQueueEventProcessingPlan, delegate, entityReferenceFactory, entityReferenceFactoryDelegate, failureHandler, identifierBridgeToDocumentIdentifierContext, projectionRegistry, stop, threadPoolProvider, toDocumentValueConvertContext, valueBridgeToIndexedValueContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.search.mapper.orm.automaticindexing.spi.AutomaticIndexingMappingContext
entityReferenceFactory, failureHandler
-
Methods inherited from interface org.hibernate.search.engine.backend.mapping.spi.BackendMappingContext
entityReferenceFactory, projectionRegistry, toDocumentValueConvertContext
-
Methods inherited from interface org.hibernate.search.mapper.pojo.bridge.runtime.spi.BridgeMappingContext
identifierBridgeToDocumentIdentifierContext, valueBridgeToIndexedValueContext
-
Methods inherited from interface org.hibernate.search.mapper.orm.session.impl.HibernateOrmSearchSessionMappingContext
failureHandler
-
Methods inherited from interface org.hibernate.search.mapper.pojo.massindexing.spi.PojoMassIndexingMappingContext
entityReferenceFactoryDelegate, threadPoolProvider
-
Methods inherited from interface org.hibernate.search.mapper.pojo.scope.spi.PojoScopeMappingContext
entityReferenceFactoryDelegate
-
Methods inherited from interface org.hibernate.search.mapper.pojo.session.spi.PojoSearchSessionMappingContext
createIndexer, createIndexingPlan, createIndexingPlan, createIndexingQueueEventProcessingPlan
-
Methods inherited from interface org.hibernate.search.mapper.orm.mapping.SearchMapping
extension, scope, scope
-
-
-
-
Method Detail
-
create
public static MappingImplementor<HibernateOrmMapping> create(PojoMappingDelegate mappingDelegate, org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmTypeContextContainer typeContextContainer, BeanHolder<? extends CoordinationStrategy> coordinationStrategyHolder, ConfiguredAutomaticIndexingStrategy configuredAutomaticIndexingStrategy, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory, ConfigurationPropertySource propertySource)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
start
public CompletableFuture<?> start(MappingStartContext context)
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
public CompletableFuture<?> preStop(MappingPreStopContext context)
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
public BackendMappingHints hints()
- Specified by:
hintsin interfaceBackendMappingContext- Overrides:
hintsin classAbstractPojoMappingImplementor<HibernateOrmMapping>
-
mappedTypeContext
public ProjectionMappedTypeContext mappedTypeContext(String mappedTypeName)
- Specified by:
mappedTypeContextin interfaceBackendMappingContext
-
scope
public <T> SearchScope<T> scope(Collection<? extends Class<? extends T>> types)
Description copied from interface:SearchMappingCreate aSearchScopelimited to the given types.- Specified by:
scopein interfaceSearchMapping- Type Parameters:
T- A supertype of all types to include in the scope.- Parameters:
types- A collection of types to include in the scope.- Returns:
- The created scope.
- See Also:
SearchScope
-
scope
public <T> SearchScope<T> scope(Class<T> expectedSuperType, Collection<String> entityNames)
Description copied from interface:SearchMappingCreate aSearchScopelimited to entity types referenced by their name.- Specified by:
scopein interfaceSearchMapping- Type Parameters:
T- A supertype of all entity types to include in the scope.- Parameters:
expectedSuperType- A supertype of all entity types to include in the scope.entityNames- A collection of entity names. SeeEntity.name().- Returns:
- The created scope.
- See Also:
SearchScope
-
toEntityManagerFactory
public EntityManagerFactory toEntityManagerFactory()
- Specified by:
toEntityManagerFactoryin interfaceSearchMapping- Returns:
- The underlying
EntityManagerFactoryused by thisSearchMapping.
-
toOrmSessionFactory
public org.hibernate.SessionFactory toOrmSessionFactory()
- Specified by:
toOrmSessionFactoryin interfaceSearchMapping- Returns:
- The underlying
SessionFactoryused by thisSearchMapping.
-
indexedEntity
public <E> SearchIndexedEntity<E> indexedEntity(Class<E> entityType)
- 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
public SearchIndexedEntity<?> indexedEntity(String entityName)
- 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
public Collection<SearchIndexedEntity<?>> allIndexedEntities()
- Specified by:
allIndexedEntitiesin interfaceSearchMapping- Returns:
- A collection containing one
SearchIndexedEntityfor each indexed entity
-
indexManager
public IndexManager indexManager(String indexName)
- Specified by:
indexManagerin interfaceSearchMapping- Parameters:
indexName- The name of an index. SeeIndexed.index().- Returns:
- The index manager for the index having
indexNameas name.
-
backend
public Backend backend()
- Specified by:
backendin interfaceSearchMapping- Returns:
- The default backend, if any.
-
backend
public Backend backend(String backendName)
- Specified by:
backendin interfaceSearchMapping- Parameters:
backendName- The name of a backend. SeeIndexed.backend().- Returns:
- The backend having
backendNameas name.
-
indexingPlanFilter
public void indexingPlanFilter(SearchIndexingPlanFilter filter)
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
public ConfiguredSearchIndexingPlanFilter applicationIndexingPlanFilter()
- Specified by:
applicationIndexingPlanFilterin interfaceHibernateOrmSearchSessionMappingContext
-
configuredSearchIndexingPlanFilter
public ConfiguredSearchIndexingPlanFilter configuredSearchIndexingPlanFilter(SearchIndexingPlanFilter filter)
- Specified by:
configuredSearchIndexingPlanFilterin interfaceHibernateOrmSearchSessionMappingContext
-
toConcreteType
public HibernateOrmMapping toConcreteType()
- Specified by:
toConcreteTypein interfaceMappingImplementor<HibernateOrmMapping>
-
cacheLookupStrategy
public EntityLoadingCacheLookupStrategy cacheLookupStrategy()
- Specified by:
cacheLookupStrategyin interfaceLoadingMappingContext
-
fetchSize
public int fetchSize()
- Specified by:
fetchSizein interfaceLoadingMappingContext
-
sessionFactory
public org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory()
- Specified by:
sessionFactoryin interfaceAutomaticIndexingMappingContext- Specified by:
sessionFactoryin interfaceHibernateOrmMappingContext- Specified by:
sessionFactoryin interfaceHibernateOrmMassIndexingMappingContext- Specified by:
sessionFactoryin interfaceHibernateOrmSearchSessionMappingContext- Returns:
- The Hibernate ORM
SessionFactory.
-
sessionContext
public HibernateOrmScopeSessionContext sessionContext(EntityManager entityManager)
- Specified by:
sessionContextin interfaceBatchMappingContext- Specified by:
sessionContextin interfaceHibernateOrmMassIndexingMappingContext- Specified by:
sessionContextin interfaceHibernateOrmScopeMappingContext- Specified by:
sessionContextin interfaceLoadingMappingContext
-
listenerEnabled
public boolean listenerEnabled()
- Specified by:
listenerEnabledin interfaceHibernateOrmListenerContextProvider
-
listenerEnabled
public void listenerEnabled(boolean enabled)
-
backgroundIndexingCompletion
public CompletableFuture<?> backgroundIndexingCompletion()
-
createMassIndexerAgent
public PojoMassIndexerAgent createMassIndexerAgent(PojoMassIndexerAgentCreateContext context)
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
public PojoIndexingPlan currentIndexingPlanIfExisting(org.hibernate.engine.spi.SessionImplementor session)
- Specified by:
currentIndexingPlanIfExistingin interfaceHibernateOrmListenerContextProvider
-
currentIndexingPlanIfTypeIncluded
public PojoTypeIndexingPlan currentIndexingPlanIfTypeIncluded(org.hibernate.engine.spi.SessionImplementor session, PojoRawTypeIdentifier<?> typeIdentifier)
- Specified by:
currentIndexingPlanIfTypeIncludedin interfaceHibernateOrmListenerContextProvider
-
createIndexingQueueEventProcessingPlan
public AutomaticIndexingQueueEventProcessingPlan createIndexingQueueEventProcessingPlan(org.hibernate.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(org.hibernate.engine.spi.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- Specified by:
typeContextProviderin interfaceHibernateOrmMassIndexingMappingContext
-
createScope
public <T> SearchScopeImpl<T> createScope(Collection<? extends Class<? extends T>> classes)
- 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(org.hibernate.engine.spi.SessionImplementor sessionImplementor)
- Specified by:
createSessionBuilderin interfaceHibernateOrmSearchSessionMappingContext
-
coordinationStrategy
public CoordinationStrategy coordinationStrategy()
- Specified by:
coordinationStrategyin interfaceCoordinationStrategyContext
-
-