/* * 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.persister.spi; import org.hibernate.HibernateException; import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy; import org.hibernate.cache.spi.access.EntityRegionAccessStrategy; import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; import org.hibernate.mapping.Collection; import org.hibernate.mapping.PersistentClass; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.service.Service; /** * Contract for creating persister instances (both {@link EntityPersister} and {@link CollectionPersister} varieties). * * @author Steve Ebersole */ public interface PersisterFactory extends Service { /** * Create an entity persister instance. * * @param entityBinding The mapping information describing the entity * @param entityCacheAccessStrategy The cache access strategy for the entity region * @param naturalIdCacheAccessStrategy The cache access strategy for the entity's natural-id cross-ref region * @param creationContext Access to additional information needed to create an EntityPersister * * @return An appropriate entity persister instance. * * @throws HibernateException Indicates a problem building the persister. */ public EntityPersister createEntityPersister( PersistentClass entityBinding, EntityRegionAccessStrategy entityCacheAccessStrategy, NaturalIdRegionAccessStrategy naturalIdCacheAccessStrategy, PersisterCreationContext creationContext) throws HibernateException; /** * Create a collection persister instance. * * @param collectionBinding The mapping information describing the collection * @param cacheAccessStrategy The cache access strategy for the collection region * @param creationContext Access to additional information needed to create an EntityPersister * * @return An appropriate collection persister instance. * * @throws HibernateException Indicates a problem building the persister. */ public CollectionPersister createCollectionPersister( Collection collectionBinding, CollectionRegionAccessStrategy cacheAccessStrategy, PersisterCreationContext creationContext) throws HibernateException; }