Class SpringJpaFactory
java.lang.Object
io.github.astrapi69.spring.orm.jpa.SpringJpaFactory
A factory class for creating jpa configuration objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DataSource
newDataSource
(DataSourceBean dataSourceBean) Factory method for create the newDataSource
object from the givenDataSourceBean
object.static org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
newEntityManagerFactoryBean
(String persistenceUnitName, DataSource dataSource, org.springframework.orm.jpa.JpaVendorAdapter vendorAdapter, Properties jpaProperties) Factory method for create the newLocalContainerEntityManagerFactoryBean
object from the given persistence unit name asString
object, theDataSource
object, theJpaVendorAdapter
object and the jpaProperties
.static org.springframework.jdbc.core.JdbcTemplate
newJdbcTemplate
(DataSource dataSource) Factory method for create the newJdbcTemplate
object from the givenDataSource
object.static org.springframework.orm.jpa.JpaVendorAdapter
newJpaVendorAdapter
(org.springframework.orm.jpa.vendor.Database db) Factory method for create the newJpaVendorAdapter
object from the givenDatabase
object.static org.springframework.orm.jpa.JpaTransactionManager
newTransactionManager
(jakarta.persistence.EntityManagerFactory entityManagerFactory) Factory method for create the newJpaTransactionManager
object from the givenEntityManagerFactory
object.
-
Constructor Details
-
SpringJpaFactory
public SpringJpaFactory()
-
-
Method Details
-
newDataSource
Factory method for create the newDataSource
object from the givenDataSourceBean
object.- Parameters:
dataSourceBean
- theDataSourceBean
object- Returns:
- the new
DataSource
-
newEntityManagerFactoryBean
public static org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean newEntityManagerFactoryBean(String persistenceUnitName, DataSource dataSource, org.springframework.orm.jpa.JpaVendorAdapter vendorAdapter, Properties jpaProperties) Factory method for create the newLocalContainerEntityManagerFactoryBean
object from the given persistence unit name asString
object, theDataSource
object, theJpaVendorAdapter
object and the jpaProperties
.- Parameters:
persistenceUnitName
- the persistence unit namedataSource
- the data sourcevendorAdapter
- the vendor adapterjpaProperties
- the jpa properties- Returns:
- the new
LocalContainerEntityManagerFactoryBean
object
-
newJdbcTemplate
Factory method for create the newJdbcTemplate
object from the givenDataSource
object.- Parameters:
dataSource
- theDataSource
object- Returns:
- the new
JdbcTemplate
-
newJpaVendorAdapter
public static org.springframework.orm.jpa.JpaVendorAdapter newJpaVendorAdapter(org.springframework.orm.jpa.vendor.Database db) Factory method for create the newJpaVendorAdapter
object from the givenDatabase
object.- Parameters:
db
- theDatabase
object- Returns:
- the new
JpaVendorAdapter
-
newTransactionManager
public static org.springframework.orm.jpa.JpaTransactionManager newTransactionManager(jakarta.persistence.EntityManagerFactory entityManagerFactory) Factory method for create the newJpaTransactionManager
object from the givenEntityManagerFactory
object.- Parameters:
entityManagerFactory
-EntityManagerFactory
object- Returns:
- the new
JpaTransactionManager
-