📈
Development Docs - Java
  • Introduction
  • General
    • Compiling and running
    • Code Style
    • Operators
    • Control Flow
    • Inheritance
    • Enums
    • Manifest
    • Immutable and Unmodifiable
    • Regular Expression
    • Executable class
    • Text Formatting
  • Beans and Objects
    • Primitives
    • Variables
    • Java Beans
    • Serialization
    • Hashcode, equals and toString
  • Generics
    • General
    • Generic Methods
    • Bound Parameters
    • Wildcards
    • Type Erasure
    • Type Parameter Naming Conventions
  • Documentation
    • Comments
    • Javadoc
      • Code Example
  • Collections and Data Structures
    • Arrays
    • Iterable
    • Collection
    • List
    • Set
    • Queue
    • Stack
    • Map
  • Introspection
    • Properties
  • Errors and Exceptions
    • General
    • Catching Exceptions
    • Checked Exceptions
  • Functional
    • General
    • Interfaces
    • Function
    • Predicate
    • Consumer
    • Supplier
    • Method References
    • Lambdas
    • Streams
      • Common Operations
      • Searching for Values
      • Other Operations
      • Data Structure Transformations
  • Internationalization
    • General
    • Locale
    • Resource Bundle
    • Formatting
  • Java Bean Validation
    • Specification
    • Annotations
    • Validator
  • Utilities Classes
    • Libraries
    • Constants Class
    • Preconditions
    • Apache Commons
      • Strings
      • Dates
    • Guava
      • Preconditions
  • JPA
    • General
    • Logging
    • JPA Entities
    • Lifecycle
    • JPQL
    • Criteria API
  • HIBERNATE
    • Logging
      • Sessions
      • Statistics
      • Queries
      • Hibernate Properties
    • More Information
  • Ant
    • Scripts
    • Examples
      • Replace Version
      • Merge Files
      • Execute Command
  • LOGGING
    • SL4J
    • Log4j
      • Logging Levels
      • Formatted Messages
      • Templated Messages
      • Mapped Diagnostic Context
    • Hikari
  • Testing
    • Libraries
    • Junit
      • Setting Up Tests
        • JUnit 4 Tests
        • JUnit 5 Tests
      • Disable Tests
      • Test Lifecycle
      • Testing Exceptions
      • Display Name
      • Test Files
      • Extensions
        • Annotation Extension
    • Mockito
      • Mocking
      • Verify Calls
      • Throw Exceptions
      • Capture Arguments
  • KeyStore
    • Types
    • Generation
    • Certificates
    • Keys
    • Reading
  • Jackson
    • General
    • Deserialize
      • Dates
      • Enums
    • Object Hierarchy
    • Ignoring Data
    • Change Field Name
    • Mixin
  • Maven
    • Execution
      • Commands
      • Parameters
      • Building the Project
    • Deployments
      • Configuration
      • Deploying Web Projects Locally
      • Deploying Documentation
    • Tests
      • Deploying the WAR for Testing
    • Site
      • Setting Up
      • Reports
      • Theme
    • Maven Lifecycle
      • Binding Plugins to Phases
    • Dependency Management
      • Artifact Repositories
    • Maven Archetype
      • Testing Archetypes
    • Configuration
      • Project Setup
      • Maven Build Plugins
      • Profiles
        • Forcing an Active Profile
      • Default Properties
      • Parent POM
      • Settings File
      • Versions
      • Extensions
      • Setting Up the JAR
        • Attach Sources
        • Attach Javadocs
        • Manifest
    • JPA
      • Generating Metamodel
    • Frontend with Maven
      • WebJars
      • npm and Webpack
    • Continuous Integration
    • Ant
    • Executable JAR
  • Spring
    • General
    • SpEL
    • Files
    • Sending Mails
  • Spring Configuration
    • Profiles
    • Conditional Configuration
    • Properties Object
  • Spring Dependence Injection
    • Injections
      • Asking for a Specific Bean
    • Injecting Values
    • Injecting Multiple Instances
    • Interdependence
    • Component Scanning
  • Spring Beans
    • Initialization
    • Destruction
    • Extending Initialization
  • Spring Data
    • Configuration
      • Common Persistence Beans
      • Datasource
      • Persistence Providers
    • Repositories
      • Custom Repositories
      • Queries
      • Sorting and Paging
      • Example API
    • Transactional
      • Configuration
      • Annotation
      • Transaction Aspect
      • Transactional Test
  • Spring MVC
    • General
    • Setting Up a Web Application
    • Serving Resources
    • Securing URLS
    • Controllers
      • Mapping and Choosing Controller Methods
      • Mapping Controller Variables
      • Request Argument Validation
      • Controller Advices
    • Error Handling
    • Binding Configuration
    • Model Attributes
    • View Resolvers
    • Resolving Sort and Pageable Arguments
    • Logging
    • Validating Request Data
  • Spring WS
    • Examples
  • Spring Boot
    • General
    • Setting Up
    • Logging development info
    • Remote Debugging
  • Spring Security
    • Examples
    • Setting Up
      • Method Security
  • Spring AOP
    • More Information
    • Configuration
    • Aspect
    • Logging Aspect Example
  • Spring Cache
    • Configuration
  • Spring Integration
    • Gateway
    • Routing
    • Services
  • Testing Spring
    • Test configuration
    • Setting Up Junit
    • Conditional Tests
    • Initializing DB
    • Spring MVC
      • Setting Up the MVC Test Context
      • Request Path Testing
      • Testing JSON
      • Argument Resolvers
      • Response Status
  • JMeter
    • General
  • Neo4J
    • More Information
    • Cypher
    • Testing
  • JQAssistant
    • More Information
    • Maven Plugin
      • Git
      • Maven Dependencies
    • Queries
      • git
      • Tags
      • File Structure
      • Structure
      • Pruning
      • Maven
      • Controller
      • Detecting Problems
      • Persistence
    • Concepts
    • Constraints
    • Groups
    • Rules
      • Custom Rules
  • AspectJ
    • Wrapping Method
Powered by GitBook
On this page
  • Hibernate
  • EclipseLink

Was this helpful?

  1. Spring Data
  2. Configuration

Persistence Providers

Hibernate

<!-- JPA EntityManagerFactory -->
<bean id="entityManagerFactory" class="${jpa.entityManagerFactory.class}">
   <property name="jpaVendorAdapter" ref="jpaAdapter" />
   <property name="dataSource" ref="dataSource" />
   <property name="persistenceUnitName" value="${jpa.persistenceUnitName}" />
   <property name="packagesToScan" value="${jpa.packagesToScan}" />
   <property name="jpaProperties" ref="jpaProperties" />
</bean>

<!-- JPA Adapter -->
<bean id="jpaAdapter" class="${jpa.adapter.class}">
   <property name="database" value="${jpa.database}" />
   <property name="showSql" value="${jpa.showSql}" />
</bean>

<!-- JPA Properties -->
<util:map id="jpaProperties">
   <entry key="hibernate.dialect" value="${hibernate.dialect}" />
   <entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" />
   <entry key="hibernate.ejb.naming_strategy" value="${hibernate.namingStrategy}" />
   <entry key="hibernate.show_sql" value="${jpa.showSql}" />
   <entry key="hibernate.format_sql" value="${hibernate.format_sql}" />
   <entry key="hibernate.cache.use_second_level_cache" value="${hibernate.cache.use_second_level_cache}" />
   <entry key="hibernate.cache.use_query_cache" value="${hibernate.cache.use_query_cache}" />
   <entry key="hibernate.cache.region.factory_class" value="${hibernate.cache.region.factory_class}" />
</util:map>
# Entity manager
jpa.adapter.class=org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter

# JPA configuration
jpa.showSql=true

# Hibernate Configuration
hibernate.hbm2ddl.auto=none
hibernate.namingStrategy=org.hibernate.cfg.ImprovedNamingStrategy
hibernate.format_sql=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory

EclipseLink

<!-- JPA EntityManagerFactory -->
<bean id="entityManagerFactory" class="${jpa.entityManagerFactory.class}">
   <property name="jpaVendorAdapter" ref="jpaAdapter" />
   <property name="dataSource" ref="dataSource" />
   <property name="persistenceUnitName" value="${jpa.persistenceUnitName}" />
   <property name="packagesToScan" value="${jpa.packagesToScan}" />
   <property name="jpaProperties" ref="jpaProperties" />
   <property name="loadTimeWeaver" ref="loadTimeWeaver" />
</bean>

<!-- Load time weaver -->
<bean id="loadTimeWeaver" class="${jpa.loadTimeWeaver.class}" />

<!-- JPA Adapter -->
<bean id="jpaAdapter" class="${jpa.adapter.class}">
   <property name="database" value="${jpa.database}" />
   <property name="showSql" value="${jpa.showSql}" />
</bean>

<!-- JPA Properties -->
<util:map id="jpaProperties">
   <entry key="eclipselink.cache.shared.default" value="${eclipselink.cache.shared.default}" />
   <entry key="eclipselink.weaving" value="${eclipselink.weaving}" />
   <entry key="eclipselink.ddl-generation" value="${eclipselink.ddl-generation}" />
   <entry key="eclipselink.ddl-generation.output-mode" value="${eclipselink.ddl-generation.output-mode}" />
   <entry key="eclipselink.allow-zero-id" value="${eclipselink.allow-zero-id}" />
   <entry key="eclipselink.id-validation" value="${eclipselink.id-validation}" />
</util:map>
# Entity manager
jpa.loadTimeWeaver.class=org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver
jpa.adapter.class=org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter

# JPA configuration
jpa.showSql=true

# Eclipselink Configuration
eclipselink.cache.shared.default=false
eclipselink.weaving=false
eclipselink.ddl-generation=none
eclipselink.ddl-generation.output-mode=database
eclipselink.allow-zero-id=true
eclipselink.id-validation=NEGATIVE
PreviousDatasourceNextRepositories

Last updated 5 years ago

Was this helpful?