Example usage for org.springframework.orm.jpa JpaTransactionManager JpaTransactionManager

List of usage examples for org.springframework.orm.jpa JpaTransactionManager JpaTransactionManager

Introduction

In this page you can find the example usage for org.springframework.orm.jpa JpaTransactionManager JpaTransactionManager.

Prototype

public JpaTransactionManager() 

Source Link

Document

Create a new JpaTransactionManager instance.

Usage

From source file:corner.orm.gae.GaeModule.java

public static PlatformTransactionManager buildPlatformTransactionManager(
        @Local EntityManagerFactory entityManagerFactory) {
    JpaTransactionManager platformTransactionManager = new JpaTransactionManager();
    platformTransactionManager.setEntityManagerFactory(entityManagerFactory);
    platformTransactionManager.afterPropertiesSet();
    return platformTransactionManager;
}

From source file:net.sp1d.chym.loader.RootConfig.java

@Bean
JpaTransactionManager transactionManager() {
    JpaTransactionManager tm = new JpaTransactionManager();
    tm.setPersistenceUnitName("net.sp1d.loader.chym_PU");
    return tm;
}

From source file:org.finra.dm.dao.config.DaoSpringModuleConfig.java

/**
 * Our Spring JPA transaction manager that will manage the JPA transactions.
 *
 * @return the JPA transaction manager.//www  .ja  va 2 s. co m
 */
@Bean
public JpaTransactionManager dmTransactionManager() {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setDataSource(getDmDataSource());
    transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
    return transactionManager;
}

From source file:org.finra.herd.dao.config.DaoSpringModuleConfig.java

/**
 * Our Spring JPA transaction manager that will manage the JPA transactions.
 *
 * @return the JPA transaction manager./*ww w.  j  av  a 2s.  co m*/
 */
@Bean
public JpaTransactionManager herdTransactionManager() {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setDataSource(getHerdDataSource());
    transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
    return transactionManager;
}

From source file:org.jgrades.data.context.DataContext.java

@Bean
JpaTransactionManager mainTransactionManager(EntityManagerFactory mainEntityManagerFactory) {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(mainEntityManagerFactory);
    return transactionManager;
}

From source file:org.mingle.pear.config.DataAccessJpaConfig.java

@Bean
public PlatformTransactionManager transactionManagerJpa(EntityManagerFactory entityManagerFactory) {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(entityManagerFactory);
    return transactionManager;
}

From source file:org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.java

@Bean
@ConditionalOnMissingBean//from w ww  .  ja  v  a  2  s  .  co m
public PlatformTransactionManager transactionManager() {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    if (this.transactionManagerCustomizers != null) {
        this.transactionManagerCustomizers.customize(transactionManager);
    }
    return transactionManager;
}

From source file:org.springframework.cloud.task.configuration.DefaultTaskConfigurer.java

@Override
public PlatformTransactionManager getTransactionManager() {
    if (this.transactionManager == null) {
        if (isDataSourceAvailable()) {
            try {
                Class.forName("javax.persistence.EntityManager");
                if (this.context != null && this.context.getBeanNamesForType(EntityManager.class).length > 0) {
                    logger.debug("EntityManager was found, using JpaTransactionManager");
                    this.transactionManager = new JpaTransactionManager();
                }/*from  w  w  w .j  ava  2 s.c o m*/
            } catch (ClassNotFoundException ignore) {
                logger.debug("No EntityManager was found, using DataSourceTransactionManager");
            } finally {
                if (this.transactionManager == null) {
                    this.transactionManager = new DataSourceTransactionManager(this.dataSource);
                }
            }
        } else {
            logger.debug("No DataSource was found, using ResourcelessTransactionManager");
            this.transactionManager = new ResourcelessTransactionManager();
        }
    }

    return this.transactionManager;
}

From source file:pas.au.pivotal.pa.sct.demo.configuration.JpaTaskConfigurer.java

@Override
public PlatformTransactionManager getTransactionManager() {
    if (this.transactionManager == null) {
        this.transactionManager = new JpaTransactionManager();
    }/*  w ww  .j av  a2 s.c  om*/

    return this.transactionManager;
}