Class JpaConfiguration


  • @EachProperty(value="jpa",
                  primary="default")
    public class JpaConfiguration
    extends Object
    Configuration for JPA and Hibernate.
    Since:
    1.0
    Author:
    graemerocher
    • Constructor Detail

      • JpaConfiguration

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

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

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

      • getName

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

        @Deprecated
        public StandardServiceRegistry buildStandardServiceRegistry​(@Nullable
                                                                    Map<String,​Object> additionalSettings)
        Deprecated.
        Deprecated and scheduled to be removed.
        Builds the standard service registry.
        Parameters:
        additionalSettings - Additional settings for the service registry
        Returns:
        The standard service registry
      • 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
                                        Map<String,​Object> jpaProperties)
        Sets the JPA properties to be passed to the JPA implementation.
        Parameters:
        jpaProperties - The JPA properties
      • getProperties

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

        @NonNull
        public 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