Class JpaConfiguration
java.lang.Object
io.micronaut.configuration.hibernate.jpa.JpaConfiguration
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable
@EachProperty(value="jpa",
primary="default")
public class JpaConfiguration
extends Object
implements io.micronaut.core.util.Toggleable
Configuration for JPA and Hibernate.
- Since:
- 1.0
- Author:
- graemerocher
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The entity scan configuration. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionJpaConfiguration
(io.micronaut.context.ApplicationContext applicationContext, @Nullable Integrator integrator) protected
JpaConfiguration
(String name, @Nullable Integrator integrator, io.micronaut.context.ApplicationContext applicationContext, @Nullable JpaConfiguration.EntityScanConfiguration entityScanConfiguration) JpaConfiguration
(String name, io.micronaut.context.ApplicationContext applicationContext, @Nullable Integrator integrator) -
Method Summary
Modifier and TypeMethodDescriptionCopies current configuration.Mapping resources (equivalent to "mapping-file" entries in persistence.xml).getName()
String[]
boolean
Compile time Hibernate proxies.boolean
boolean
void
setCompileTimeHibernateProxies
(boolean compileTimeHibernateProxies) Enable compile time Hibernate proxies.void
setEnabled
(boolean enabled) Set whether the JPA integration for the datasource is enabled.void
setMappingResources
(List<String> mappingResources) Sets additional mapping resources.void
setPackagesToScan
(String... packagesToScan) Sets the packages to scan.final void
setProperties
(@NonNull Map<String, Object> jpaProperties) Sets the JPA properties to be passed to the JPA implementation.void
setReactive
(boolean reactive)
-
Field Details
-
PREFIX
- See Also:
-
PRIMARY
- See Also:
-
-
Constructor Details
-
JpaConfiguration
public JpaConfiguration(io.micronaut.context.ApplicationContext applicationContext, @Nullable @Nullable Integrator integrator) - Parameters:
applicationContext
- The application contextintegrator
- TheIntegrator
-
JpaConfiguration
public JpaConfiguration(@Parameter String name, io.micronaut.context.ApplicationContext applicationContext, @Nullable @Nullable Integrator integrator) - Parameters:
name
- The nameapplicationContext
- The application contextintegrator
- TheIntegrator
-
JpaConfiguration
@Inject protected JpaConfiguration(@Parameter String name, @Nullable @Nullable Integrator integrator, io.micronaut.context.ApplicationContext applicationContext, @Nullable @Nullable JpaConfiguration.EntityScanConfiguration entityScanConfiguration) - Parameters:
name
- The nameintegrator
- The integratorapplicationContext
- The application contextentityScanConfiguration
- The entity scan configuration
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceio.micronaut.core.util.Toggleable
-
setEnabled
public void setEnabled(boolean enabled) Set whether the JPA integration for the datasource is enabled.- Parameters:
enabled
- True if it is enabled
-
getName
- Returns:
- The configuration name
-
getEntityScanConfiguration
- Returns:
- The entity scan configuration
-
setPackagesToScan
Sets the packages to scan.- Parameters:
packagesToScan
- The packages to scan
-
getPackagesToScan
- Returns:
- The packages to scan
-
setProperties
public final void setProperties(@MapFormat(transformation=FLAT,keyFormat=RAW) @NonNull @NonNull Map<String, Object> jpaProperties) Sets the JPA properties to be passed to the JPA implementation.- Parameters:
jpaProperties
- The JPA properties
-
getProperties
- Returns:
- The JPA properties
-
getMappingResources
Mapping resources (equivalent to "mapping-file" entries in persistence.xml).- Returns:
- The mapping resources
-
setMappingResources
Sets additional mapping resources.- Parameters:
mappingResources
- list of mapping files
-
isCompileTimeHibernateProxies
public boolean isCompileTimeHibernateProxies()Compile time Hibernate proxies.- Returns:
- true if compile time proxies enabled
-
setCompileTimeHibernateProxies
public void setCompileTimeHibernateProxies(boolean compileTimeHibernateProxies) Enable compile time Hibernate proxies.- Parameters:
compileTimeHibernateProxies
- true to enable compile time proxies
-
isReactive
public boolean isReactive()- Returns:
- is reactive
-
setReactive
public void setReactive(boolean reactive) - Parameters:
reactive
- the reactive value
-
copy
Copies current configuration.- Parameters:
name
- A new name- Returns:
- A copy of current configuration
-