Search in sources :

Example 66 with JpaTransactionManager

use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.

the class H2TestProfileJPAConfig method transactionManager.

@Bean
JpaTransactionManager transactionManager(final EntityManagerFactory entityManagerFactory) {
    final JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(entityManagerFactory);
    return transactionManager;
}
Also used : JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 67 with JpaTransactionManager

use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.

the class UserConfig method userTransactionManager.

@Primary
@Bean
public PlatformTransactionManager userTransactionManager() {
    final JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(userEntityManager().getObject());
    return transactionManager;
}
Also used : JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 68 with JpaTransactionManager

use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.

the class PersistenceJPAConfig method transactionManager.

@Bean
public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) {
    final JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(emf);
    return transactionManager;
}
Also used : JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 69 with JpaTransactionManager

use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.

the class StudentJPAH2Config method transactionManager.

@Bean
JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(entityManagerFactory);
    return transactionManager;
}
Also used : JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Example 70 with JpaTransactionManager

use of org.springframework.orm.jpa.JpaTransactionManager in project tutorials by eugenp.

the class PersistenceConfig method jpaTransactionManager.

@Bean
public PlatformTransactionManager jpaTransactionManager() {
    final JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
    return transactionManager;
}
Also used : JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) LocalSessionFactoryBean(org.springframework.orm.hibernate4.LocalSessionFactoryBean)

Aggregations

JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)76 Bean (org.springframework.context.annotation.Bean)59 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)57 Autowired (org.springframework.beans.factory.annotation.Autowired)12 EntityManagerFactory (javax.persistence.EntityManagerFactory)8 Primary (org.springframework.context.annotation.Primary)7 Test (org.junit.Test)4 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)4 EntityManagerHolder (org.springframework.orm.jpa.EntityManagerHolder)4 EntityManager (javax.persistence.EntityManager)3 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)3 Stack (java.util.Stack)2 Test (org.junit.jupiter.api.Test)2 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)1 Iec61850CoreDbApiException (com.alliander.osgp.core.db.api.iec61850.exceptions.Iec61850CoreDbApiException)1 AugmentableQueryRepositoryFactoryBean (com.thinkbiganalytics.metadata.jpa.feed.AugmentableQueryRepositoryFactoryBean)1 EntityManager (jakarta.persistence.EntityManager)1 EntityManagerFactory (jakarta.persistence.EntityManagerFactory)1 EntityTransaction (jakarta.persistence.EntityTransaction)1 PrintWriter (java.io.PrintWriter)1