Package com.patreonshout.config
Class JPAConfiguration
java.lang.Object
com.patreonshout.config.JPAConfiguration
@Configuration
public class JPAConfiguration
extends java.lang.Object
SpringBoot Database Management Configuration
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String
dsPassword
dsPassword is the data source password we use to connect to the database(package private) java.lang.String
dsUrl
dsUrl is the data source url that is used to connect to the database(package private) java.lang.String
dsUsername
dsUsername is the data source username we use to connect to the database -
Constructor Summary
Constructors Constructor Description JPAConfiguration()
-
Method Summary
Modifier and Type Method Description javax.sql.DataSource
dataSource()
Configures the data source to our database(package private) org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
entityManagerFactory()
Configures theEntityManager
that is used to create database communications in the applicationprivate java.util.Properties
jpaHibernateProperties()
Configures JPA Hibernate Properties to show the sql used when communicating with the databaseorg.springframework.orm.jpa.JpaTransactionManager
transactionManager()
Java Persistence API Transaction Manager between the program and our databaseprivate org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
vendorAdapter()
Connects Hibernate's persistence provider and Hibernate's Session as extended EntityManager interface, and adapts the JpaVendorAdaptor configuration settingsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
dsUrl
@Value("${spring.datasource.url}") java.lang.String dsUrldsUrl is the data source url that is used to connect to the database -
dsUsername
@Value("${spring.datasource.username}") java.lang.String dsUsernamedsUsername is the data source username we use to connect to the database -
dsPassword
@Value("${spring.datasource.password}") java.lang.String dsPassworddsPassword is the data source password we use to connect to the database
-
-
Constructor Details
-
JPAConfiguration
public JPAConfiguration()
-
-
Method Details
-
dataSource
@Bean public javax.sql.DataSource dataSource()Configures the data source to our database- Returns:
- a
DataSource
object that will connect to our database
-
transactionManager
@Bean public org.springframework.orm.jpa.JpaTransactionManager transactionManager()Java Persistence API Transaction Manager between the program and our database- Returns:
- a
JpaTransactionManager
object that will manage the transactions we have with our database
-
vendorAdapter
private org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter vendorAdapter()Connects Hibernate's persistence provider and Hibernate's Session as extended EntityManager interface, and adapts the JpaVendorAdaptor configuration settings- Returns:
- a
HibernateJpaVendorAdapter
object that lets us use Hibernate with the EntityManager
-
entityManagerFactory
@Bean org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean entityManagerFactory()Configures theEntityManager
that is used to create database communications in the application- Returns:
- a
LocalContainerEntityManagerFactoryBean
that is used to create our Entity Manager
-
jpaHibernateProperties
private java.util.Properties jpaHibernateProperties()Configures JPA Hibernate Properties to show the sql used when communicating with the database- Returns:
- a
Properties
that the Entity Manager will use to be configured
-