Package io.dropwizard.hibernate
Class HibernateBundle<T>
java.lang.Object
io.dropwizard.hibernate.HibernateBundle<T>
- All Implemented Interfaces:
ConfiguredBundle<T>
,DatabaseConfiguration<T>
- Direct Known Subclasses:
HibernateBundle
,ScanningHibernateBundle
public abstract class HibernateBundle<T>
extends Object
implements ConfiguredBundle<T>, DatabaseConfiguration<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
protected boolean
protected @Nullable org.hibernate.SessionFactory
protected final SessionFactoryFactory
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
HibernateBundle
(Class<?> entity, Class<?>... entities) protected
HibernateBundle
(List<Class<?>> entities, SessionFactoryFactory sessionFactoryFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
configure
(org.hibernate.cfg.Configuration configuration) protected com.fasterxml.jackson.datatype.hibernate5.jakarta.Hibernate5JakartaModule
Override to configure theHibernate5JakartaModule
.org.hibernate.SessionFactory
final void
initialize
(Bootstrap<?> bootstrap) boolean
protected String
name()
Override to configure the name of the bundle (It's used for the bundle health check and database pool metrics)protected UnitOfWorkApplicationListener
registerUnitOfWorkListenerIfAbsent
(Environment environment) void
run
(T configuration, Environment environment) void
setLazyLoadingEnabled
(boolean lazyLoadingEnabled) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.dropwizard.db.DatabaseConfiguration
getDataSourceFactory
-
Field Details
-
DEFAULT_NAME
- See Also:
-
sessionFactory
protected @Nullable org.hibernate.SessionFactory sessionFactory -
lazyLoadingEnabled
protected boolean lazyLoadingEnabled -
entities
-
sessionFactoryFactory
-
-
Constructor Details
-
HibernateBundle
-
HibernateBundle
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfaceConfiguredBundle<T>
-
createHibernate5Module
protected com.fasterxml.jackson.datatype.hibernate5.jakarta.Hibernate5JakartaModule createHibernate5Module()Override to configure theHibernate5JakartaModule
. -
name
Override to configure the name of the bundle (It's used for the bundle health check and database pool metrics) -
run
- Specified by:
run
in interfaceConfiguredBundle<T>
- Throws:
Exception
-
registerUnitOfWorkListenerIfAbsent
-
isLazyLoadingEnabled
public boolean isLazyLoadingEnabled() -
setLazyLoadingEnabled
public void setLazyLoadingEnabled(boolean lazyLoadingEnabled) -
getSessionFactory
public org.hibernate.SessionFactory getSessionFactory() -
configure
protected void configure(org.hibernate.cfg.Configuration configuration)
-