org.hibernate.integrator.spi.Integrator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* 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 .
*/
package org.hibernate.integrator.spi;
import org.hibernate.Incubating;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
/**
* Contract for stuff that integrates with Hibernate.
*
* IMPL NOTE: called during session factory initialization (constructor), so not all parts of the passed session factory
* will be available.
*
* @author Steve Ebersole
* @since 4.0
*/
public interface Integrator {
/**
* Perform integration.
*
* @param metadata The "compiled" representation of the mapping information
* @param sessionFactory The session factory being created
* @param serviceRegistry The session factory's service registry
* @deprecated (since 6.0) - use
*/
@Deprecated
default void integrate(
Metadata metadata,
SessionFactoryImplementor sessionFactory,
SessionFactoryServiceRegistry serviceRegistry) {
throw new UnsupportedOperationException( "Call to un-implemented deprecated legacy `Integrator#integrate` overload form" );
}
/**
* Perform integration.
*
* @param metadata The fully initialized boot-time mapping model
* @param bootstrapContext The context for bootstrapping of the SessionFactory
* @param sessionFactory The SessionFactory being created
*
* todo (6.0) : why pass the `serviceRegistry`? Why not just grab it from the SessionFactory?
*/
@Incubating
default void integrate(
Metadata metadata,
BootstrapContext bootstrapContext,
SessionFactoryImplementor sessionFactory) {
// simply call the legacy one, keeping implementors bytecode compatible.
integrate( metadata, sessionFactory, (SessionFactoryServiceRegistry) sessionFactory.getServiceRegistry() );
}
/**
* Tongue-in-cheek name for a shutdown callback.
*
* @param sessionFactory The session factory being closed.
* @param serviceRegistry That session factory's service registry
*/
void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry);
}