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.StringdsPassworddsPassword is the data source password we use to connect to the database(package private) java.lang.StringdsUrldsUrl is the data source url that is used to connect to the database(package private) java.lang.StringdsUsernamedsUsername 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.DataSourcedataSource()Configures the data source to our database(package private) org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBeanentityManagerFactory()Configures theEntityManagerthat is used to create database communications in the applicationprivate java.util.PropertiesjpaHibernateProperties()Configures JPA Hibernate Properties to show the sql used when communicating with the databaseorg.springframework.orm.jpa.JpaTransactionManagertransactionManager()Java Persistence API Transaction Manager between the program and our databaseprivate org.springframework.orm.jpa.vendor.HibernateJpaVendorAdaptervendorAdapter()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
DataSourceobject 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
JpaTransactionManagerobject 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
HibernateJpaVendorAdapterobject that lets us use Hibernate with the EntityManager
-
entityManagerFactory
@Bean org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean entityManagerFactory()Configures theEntityManagerthat is used to create database communications in the application- Returns:
- a
LocalContainerEntityManagerFactoryBeanthat 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
Propertiesthat the Entity Manager will use to be configured
-