Class JPAPropertiesPersistenceUnitPostProcessor

java.lang.Object
org.broadleafcommerce.common.extensibility.jpa.JPAPropertiesPersistenceUnitPostProcessor
All Implemented Interfaces:
org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor

public class JPAPropertiesPersistenceUnitPostProcessor extends Object implements org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor
This class allows us to override Persistence Unit properties on a per-environment basis. Spring's PersistenceUnitManager allows us to pass in a list of PersistenceUnitPostProcessors. This class will allow us to override or add custom JPA properties to the Persistence Unit. This is useful when different environments have different requirements for JPA properties. The best example of this is SQL Dialect. You may want to use a dialect such as Oracle for production and test environments, and perhaps HSQLDB for local and integration testing. You can set the dialect property using Spring profiles and properties. The keys will be the same in each environment, but the values would be defined in the environment-specific properties files. If you want the property to be added only to certain environments, add the value "null" to the properties file. For example: classpath*:/META-INF/mycompany_persistence.xml
  • Field Details

    • persistenceUnitProperties

      protected Map<String,String> persistenceUnitProperties
    • overrideProperties

      protected Map<String,String> overrideProperties
    • compositeAutoImportSql

      protected CompositeAutoImportSql compositeAutoImportSql
    • blPUHibernateHbm2ddlAuto

      @Value("${blPU.hibernate.hbm2ddl.auto}") protected String blPUHibernateHbm2ddlAuto
    • blPUHibernateDialect

      @Value("${blPU.hibernate.dialect}") protected String blPUHibernateDialect
    • blPUHibernateShow_sql

      @Value("${blPU.hibernate.show_sql}") protected String blPUHibernateShow_sql
    • blPUHibernateCacheUse_second_level_cache

      @Value("${blPU.hibernate.cache.use_second_level_cache}") protected String blPUHibernateCacheUse_second_level_cache
    • blPUHibernateCacheUse_query_cache

      @Value("${blPU.hibernate.cache.use_query_cache}") protected String blPUHibernateCacheUse_query_cache
    • blPUHibernateHbm2ddlImport_files

      @Value("${blPU.hibernate.hbm2ddl.import_files}") protected String blPUHibernateHbm2ddlImport_files
    • blPUHibernateHbm2ddlImport_files_sql_extractor

      @Value("${blPU.hibernate.hbm2ddl.import_files_sql_extractor}") protected String blPUHibernateHbm2ddlImport_files_sql_extractor
    • blPUHibernateNamingImplicitStrategy

      @Value("${blPU.hibernate.implicit_naming_strategy}") protected String blPUHibernateNamingImplicitStrategy
    • blPUHibernateNamingPhysicalStrategy

      @Value("${blPU.hibernate.physical_naming_strategy}") protected String blPUHibernateNamingPhysicalStrategy
    • blCMSStorageHibernateHbm2ddlAuto

      @Value("${blCMSStorage.hibernate.hbm2ddl.auto}") protected String blCMSStorageHibernateHbm2ddlAuto
    • blCMSStorageHibernateDialect

      @Value("${blCMSStorage.hibernate.dialect}") protected String blCMSStorageHibernateDialect
    • blCMSStorageHibernateShow_sql

      @Value("${blCMSStorage.hibernate.show_sql}") protected String blCMSStorageHibernateShow_sql
    • blCMSStorageHibernateCacheUse_second_level_cache

      @Value("${blCMSStorage.hibernate.cache.use_second_level_cache}") protected String blCMSStorageHibernateCacheUse_second_level_cache
    • blCMSStorageHibernateCacheUse_query_cache

      @Value("${blCMSStorage.hibernate.cache.use_query_cache}") protected String blCMSStorageHibernateCacheUse_query_cache
    • blCMSStorageHibernateHbm2ddlImport_files

      @Value("${blCMSStorage.hibernate.hbm2ddl.import_files}") protected String blCMSStorageHibernateHbm2ddlImport_files
    • blCMSStorageHibernateHbm2ddlImport_files_sql_extractor

      @Value("${blCMSStorage.hibernate.hbm2ddl.import_files_sql_extractor}") protected String blCMSStorageHibernateHbm2ddlImport_files_sql_extractor
    • blCMSStorageHibernateNamingImplicitStrategy

      @Value("${blCMSStorage.hibernate.implicit_naming_strategy}") protected String blCMSStorageHibernateNamingImplicitStrategy
    • blCMSStorageHibernateNamingPhysicalStrategy

      @Value("${blCMSStorage.hibernate.physical_naming_strategy}") protected String blCMSStorageHibernateNamingPhysicalStrategy
    • blSecurePUHibernateHbm2ddlAuto

      @Value("${blSecurePU.hibernate.hbm2ddl.auto}") protected String blSecurePUHibernateHbm2ddlAuto
    • blSecurePUHibernateDialect

      @Value("${blSecurePU.hibernate.dialect}") protected String blSecurePUHibernateDialect
    • blSecurePUHibernateShow_sql

      @Value("${blSecurePU.hibernate.show_sql}") protected String blSecurePUHibernateShow_sql
    • blSecurePUHibernateCacheUse_second_level_cache

      @Value("${blSecurePU.hibernate.cache.use_second_level_cache}") protected String blSecurePUHibernateCacheUse_second_level_cache
    • blSecurePUHibernateCacheUse_query_cache

      @Value("${blSecurePU.hibernate.cache.use_query_cache}") protected String blSecurePUHibernateCacheUse_query_cache
    • blSecurePUHibernateHbm2ddlImport_files

      @Value("${blSecurePU.hibernate.hbm2ddl.import_files}") protected String blSecurePUHibernateHbm2ddlImport_files
    • blSecurePUHibernateHbm2ddlImport_files_sql_extractor

      @Value("${blSecurePU.hibernate.hbm2ddl.import_files_sql_extractor}") protected String blSecurePUHibernateHbm2ddlImport_files_sql_extractor
    • blSecurePUHibernateNamingImplicitStrategy

      @Value("${blSecurePU.hibernate.implicit_naming_strategy}") protected String blSecurePUHibernateNamingImplicitStrategy
    • blSecurePUHibernateNamingPhysicalStrategy

      @Value("${blSecurePU.hibernate.physical_naming_strategy}") protected String blSecurePUHibernateNamingPhysicalStrategy
  • Constructor Details

    • JPAPropertiesPersistenceUnitPostProcessor

      public JPAPropertiesPersistenceUnitPostProcessor()
  • Method Details

    • populatePresetProperties

      @PostConstruct public void populatePresetProperties()
    • postProcessPersistenceUnitInfo

      public void postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui)
      Specified by:
      postProcessPersistenceUnitInfo in interface org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor
    • setPersistenceUnitProperties

      public void setPersistenceUnitProperties(Map<String,String> properties)