Top Description Methods
org.hibernate

public Interface SessionFactoryObserver

extends Serializable
Known Direct Implementers
org.hibernate.boot.internal.SessionFactoryObserverForNamedQueryValidation, org.hibernate.boot.internal.SessionFactoryObserverForRegistration, org.hibernate.boot.internal.SessionFactoryObserverForSchemaExport, org.hibernate.bytecode.internal.SessionFactoryObserverForBytecodeEnhancer, org.hibernate.internal.SessionFactoryImpl.IntegratorObserver, org.hibernate.internal.SessionFactoryObserverChain, org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.ServiceRegistryCloser, org.hibernate.type.spi.TypeConfiguration
Imports
java.io.Serializable

Allows reaction to basic SessionFactory lifecycle events.

A SessionFactoryObserver may be registered using the configuration property hibernate.session_factory_observer.

Author
Steve Ebersole
See Also
org.hibernate.cfg.AvailableSettings#SESSION_FACTORY_OBSERVER, org.hibernate.boot.SessionFactoryBuilder#addSessionFactoryObservers(SessionFactoryObserver...)

Method Summary

Modifier and TypeMethod and Description
public default void
sessionFactoryClosed(SessionFactory
The factory closed.
factory
)

Callback to indicate that the given factory has been closed.

public default void
sessionFactoryClosing(SessionFactory
The factory about to be closed.
factory
)

Callback to indicate that the given factory is about to close.

public default void
sessionFactoryCreated(SessionFactory
The factory initialized.
factory
)

Callback to indicate that the given factory has been created and is now ready for use.

Method Detail

sessionFactoryClosedback to summary
public default void sessionFactoryClosed(SessionFactory factory)

Callback to indicate that the given factory has been closed. Care should be taken in how (if at all) the passed factory reference is used since it is closed.

Parameters
factory:SessionFactory

The factory closed.

sessionFactoryClosingback to summary
public default void sessionFactoryClosing(SessionFactory factory)

Callback to indicate that the given factory is about to close. The passed factory reference should be usable since it is only about to close.

API Note

defined as default to allow for existing SessionFactoryObserver implementations to work in 5.2. Starting in 6.0 the default will be removed and implementations will be required to implement this new method.

Parameters
factory:SessionFactory

The factory about to be closed.

Since
5.2
sessionFactoryCreatedback to summary
public default void sessionFactoryCreated(SessionFactory factory)

Callback to indicate that the given factory has been created and is now ready for use.

Parameters
factory:SessionFactory

The factory initialized.