Class ScanningHibernateBundle<T>

java.lang.Object
io.dropwizard.hibernate.HibernateBundle<T>
io.dropwizard.hibernate.ScanningHibernateBundle<T>
All Implemented Interfaces:
ConfiguredBundle<T>, DatabaseConfiguration<T>

public abstract class ScanningHibernateBundle<T> extends HibernateBundle<T>
Extension of HibernateBundle that scans given package for entities instead of giving them by hand.
  • Constructor Details

    • ScanningHibernateBundle

      protected ScanningHibernateBundle(String pckg)
      Parameters:
      pckg - string with package containing Hibernate entities (classes annotated with Hibernate @Entity annotation) e. g. com.codahale.fake.db.directory.entities
    • ScanningHibernateBundle

      protected ScanningHibernateBundle(String pckg, SessionFactoryFactory sessionFactoryFactory)
    • ScanningHibernateBundle

      protected ScanningHibernateBundle(String[] pckgs, SessionFactoryFactory sessionFactoryFactory)
  • Method Details

    • findEntityClassesFromDirectory

      public static List<Class<?>> findEntityClassesFromDirectory(String[] pckgs)
      Method scanning given directory for classes containing Hibernate @Entity annotation
      Parameters:
      pckgs - string array with packages containing Hibernate entities (classes annotated with @Entity annotation) e.g. com.codahale.fake.db.directory.entities
      Returns:
      ImmutableList with classes from given directory annotated with Hibernate @Entity annotation