Package com.axelor.db
Class JpaModule
- java.lang.Object
-
- com.google.inject.AbstractModule
-
- com.axelor.db.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JpaModule.Initializer
-
Constructor Summary
Constructors Constructor Description JpaModule(String jpaUnit)
Create a new instance of theJpaModule
with the given persistence unit name with autoscan and autostart enabled.JpaModule(String jpaUnit, boolean autoscan, boolean autostart)
Create new instance of theJpaModule
with the given persistence unit name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configure()
JpaModule
scan(String pkg)
-
Methods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
-
-
-
Constructor Detail
-
JpaModule
public JpaModule(String jpaUnit, boolean autoscan, boolean autostart)
Create new instance of theJpaModule
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 nameautoscan
- whether to enable autoscanautostart
- whether to automatically start persistence service
-
-
Method Detail
-
configure
protected void configure()
- Overrides:
configure
in classAbstractModule
-
-