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 Details

    • DEFAULT_NAME

      public static final String DEFAULT_NAME
      See Also:
    • sessionFactory

      protected @Nullable org.hibernate.SessionFactory sessionFactory
    • lazyLoadingEnabled

      protected boolean lazyLoadingEnabled
    • entities

      protected final List<Class<?>> entities
    • sessionFactoryFactory

      protected final SessionFactoryFactory sessionFactoryFactory
  • Constructor Details

    • HibernateBundle

      protected HibernateBundle(Class<?> entity, Class<?>... entities)
    • HibernateBundle

      protected HibernateBundle(List<Class<?>> entities, SessionFactoryFactory sessionFactoryFactory)
  • Method Details

    • initialize

      public final void initialize(Bootstrap<?> bootstrap)
      Specified by:
      initialize in interface ConfiguredBundle<T>
    • createHibernate5Module

      protected com.fasterxml.jackson.datatype.hibernate5.jakarta.Hibernate5JakartaModule createHibernate5Module()
      Override to configure the Hibernate5JakartaModule.
    • name

      protected String name()
      Override to configure the name of the bundle (It's used for the bundle health check and database pool metrics)
    • run

      public void run(T configuration, Environment environment) throws Exception
      Specified by:
      run in interface ConfiguredBundle<T>
      Throws:
      Exception
    • registerUnitOfWorkListenerIfAbsent

      protected UnitOfWorkApplicationListener registerUnitOfWorkListenerIfAbsent(Environment environment)
    • 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)