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(EntityManagerFactory emf) 

Source Link

Document

Create a new JpaTransactionManager instance.

Usage

From source file:com.gopivotal.cla.repository.RepositoryConfiguration.java

@Bean
PlatformTransactionManager transactionManager() {
    return new JpaTransactionManager(entityManagerFactory());
}

From source file:org.homiefund.config.ApplicationConfiguration.java

@Bean
@Description("JPA Transaction Manager used for controlling transaction using @Transactional annotation.")
public JpaTransactionManager jpaTransactionManager() {
    return new JpaTransactionManager(emf.getObject());
}

From source file:example.app.config.jpa.JpaConfiguration.java

@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
    return new JpaTransactionManager(entityManagerFactory);
}

From source file:pl.softech.eav.HSqlConfig.java

@Bean
public JpaTransactionManager transactionManager(final EntityManagerFactory emf) {
    return new JpaTransactionManager(emf);
}

From source file:com.sg.domain.jpa.spring.PersistenceContextConfig.java

@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
    return new JpaTransactionManager(emf);
}

From source file:com.app.config.App2Config.java

@Bean(name = "appTransactionManager")
public PlatformTransactionManager transactionManager() {
    return new JpaTransactionManager(entityManagerFactory());
}

From source file:fr.univlorraine.mondossierweb.config.JpaConfigApogee.java

/**
 * Transaction Manager/*from  w  w w .ja v a  2  s.  c o  m*/
 * @return
 */
@Bean
public JpaTransactionManager transactionManagerApogee() {
    return new JpaTransactionManager(entityManagerFactoryApogee().getObject());
}

From source file:org.springsource.html5expenses.config.ServicesConfiguration.java

@Bean
public PlatformTransactionManager transactionManager() throws Exception {
    EntityManagerFactory entityManagerFactory = entityManagerFactory().getObject();
    return new JpaTransactionManager(entityManagerFactory);
}

From source file:name.marcelomorales.siqisiqi.examples.crud.CrudContext.java

@Bean
public PlatformTransactionManager transactionManager() throws Exception {
    return new JpaTransactionManager(entityManagerFactory());
}

From source file:eu.supersede.fe.multitenant.MultiJpaProvider.java

@PostConstruct
private void load() {
    Map<String, DataSource> datasources = dataSourceBasedMultiTenantConnectionProviderImpl.getDataSources();

    repositoriesFactory = new HashMap<>();

    for (String n : datasources.keySet()) {
        try {/*from   w  w  w . j  av a  2  s . co  m*/
            log.info("Loading database: " + datasources.get(n).getConnection().getMetaData().getURL());
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        Map<String, Object> hibernateProps = new LinkedHashMap<>();
        hibernateProps.putAll(jpaProperties.getHibernateProperties(datasources.get(n)));

        hibernateProps.put(Environment.DIALECT, "org.hibernate.dialect.PostgreSQLDialect");

        Set<String> packages = new HashSet<>();
        String[] tmp = MODELS_PACKAGES.split(",");

        for (String t : tmp) {
            packages.add(t.trim());
        }

        LocalContainerEntityManagerFactoryBean emfb = builder.dataSource(datasources.get(n))
                .packages(packages.toArray(new String[packages.size()])).properties(hibernateProps).jta(false)
                .build();

        emfb.afterPropertiesSet();
        EntityManagerFactory emf = emfb.getObject();
        EntityManager em = emf.createEntityManager();

        final JpaTransactionManager jpaTranMan = new JpaTransactionManager(emf);
        JpaRepositoryFactory jpaFactory = new JpaRepositoryFactory(em);
        jpaFactory.addRepositoryProxyPostProcessor(new MultiJpaRepositoryProxyPostProcessor(jpaTranMan));

        repositoriesFactory.put(n, new ContainerUtil(jpaFactory, emf, em));
    }
}