Package com.axelor.db

Class JpaModule

  • All Implemented Interfaces:
    Module

    public class JpaModule
    extends AbstractModule
    A Guice module to configure JPA.

    This module takes care of initializing JPA and registers an Hibernate custom scanner that automatically scans all the classpath entries for Entity classes.

    • Constructor Detail

      • JpaModule

        public JpaModule​(String jpaUnit,
                         boolean autoscan,
                         boolean autostart)
        Create new instance of the JpaModule with the given persistence unit name.

        If autoscan is true then a custom Hibernate scanner will be used to scan all the classpath entries for Entity classes.

        If autostart is true then the PersistService will be started automatically.

        Parameters:
        jpaUnit - the persistence unit name
        autoscan - whether to enable autoscan
        autostart - whether to automatically start persistence service
      • JpaModule

        public JpaModule​(String jpaUnit)
        Create a new instance of the JpaModule with the given persistence unit name with autoscan and autostart enabled.
        Parameters:
        jpaUnit - the persistence unit name