Search in sources :

Example 21 with JpaTransactionManager

use of org.springframework.orm.jpa.JpaTransactionManager in project invesdwin-context-persistence by subes.

the class PersistenceUnitContext method createTransactionManager.

private PlatformTransactionManager createTransactionManager() {
    final JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
    jpaTransactionManager.setEntityManagerFactory(getEntityManagerFactory());
    final JpaDialect jpaDialect = getJpaDialect();
    if (jpaDialect != null) {
        jpaTransactionManager.setJpaDialect(jpaDialect);
    }
    final LoggingDelegateTransactionManager loggingDelegateTransactionManager = new LoggingDelegateTransactionManager(this, jpaTransactionManager);
    final String transactionManagerBeanName = getPersistenceUnitName() + PersistenceProperties.TRANSACTION_MANAGER_NAME_SUFFIX;
    MergedContext.getInstance().registerBean(transactionManagerBeanName, loggingDelegateTransactionManager);
    Assertions.assertThat(MergedContext.getInstance().getBean(transactionManagerBeanName)).isNotNull();
    return loggingDelegateTransactionManager;
}
Also used : JpaDialect(org.springframework.orm.jpa.JpaDialect) JpaTransactionManager(org.springframework.orm.jpa.JpaTransactionManager) LoggingDelegateTransactionManager(de.invesdwin.context.persistence.jpa.scanning.transaction.LoggingDelegateTransactionManager)

Example 22 with JpaTransactionManager

use of org.springframework.orm.jpa.JpaTransactionManager in project herd by FINRAOS.

the class DaoSpringModuleConfig method herdTransactionManager.

/**
 * Our Spring JPA transaction manager that will manage the JPA transactions.
 *
 * @return the JPA transaction manager.
 */
@Bean
public JpaTransactionManager herdTransactionManager() {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setDataSource(getHerdDataSource());
    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)

Example 23 with JpaTransactionManager

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

the class HibernateSearchConfig method transactionManager.

@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
    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 24 with JpaTransactionManager

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

the class PersistenceDerbyJPAConfig 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 25 with JpaTransactionManager

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

the class PersistenceJNDIConfig 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)

Aggregations

JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)70 Bean (org.springframework.context.annotation.Bean)54 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)54 Autowired (org.springframework.beans.factory.annotation.Autowired)12 EntityManagerFactory (javax.persistence.EntityManagerFactory)8 Test (org.junit.Test)5 Primary (org.springframework.context.annotation.Primary)5 EntityManagerHolder (org.springframework.orm.jpa.EntityManagerHolder)4 EntityManager (javax.persistence.EntityManager)3 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)3 Stack (java.util.Stack)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)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 LoggingDelegateTransactionManager (de.invesdwin.context.persistence.jpa.scanning.transaction.LoggingDelegateTransactionManager)1 EntityManager (jakarta.persistence.EntityManager)1 EntityManagerFactory (jakarta.persistence.EntityManagerFactory)1 EntityTransaction (jakarta.persistence.EntityTransaction)1 PrintWriter (java.io.PrintWriter)1