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
  • Field Details

  • Constructor Details

    • JpaConfiguration

      public JpaConfiguration(io.micronaut.context.ApplicationContext applicationContext, @Nullable @Nullable Integrator integrator)
      Parameters:
      applicationContext - The application context
      integrator - The Integrator
    • JpaConfiguration

      public JpaConfiguration(@Parameter String name, io.micronaut.context.ApplicationContext applicationContext, @Nullable @Nullable Integrator integrator)
      Parameters:
      name - The name
      applicationContext - The application context
      integrator - The Integrator
    • JpaConfiguration

      @Inject protected JpaConfiguration(@Parameter String name, @Nullable @Nullable Integrator integrator, io.micronaut.context.ApplicationContext applicationContext, @Nullable @Nullable JpaConfiguration.EntityScanConfiguration entityScanConfiguration)
      Parameters:
      name - The name
      integrator - The integrator
      applicationContext - The application context
      entityScanConfiguration - The entity scan configuration
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface io.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

      public String getName()
      Returns:
      The configuration name
    • getEntityScanConfiguration

      public JpaConfiguration.EntityScanConfiguration getEntityScanConfiguration()
      Returns:
      The entity scan configuration
    • setPackagesToScan

      public void setPackagesToScan(String... packagesToScan)
      Sets the packages to scan.
      Parameters:
      packagesToScan - The packages to scan
    • getPackagesToScan

      public String[] 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

      @NonNull public @NonNull Map<String,Object> getProperties()
      Returns:
      The JPA properties
    • getMappingResources

      @NonNull public @NonNull List<String> getMappingResources()
      Mapping resources (equivalent to "mapping-file" entries in persistence.xml).
      Returns:
      The mapping resources
    • setMappingResources

      public void setMappingResources(List<String> mappingResources)
      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

      public JpaConfiguration copy(String name)
      Copies current configuration.
      Parameters:
      name - A new name
      Returns:
      A copy of current configuration