Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.edu.ifpb.blogsoon.webapp.config; import javax.persistence.EntityManagerFactory; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; /** * * @author Emanuel Batista da Silva Filho - emanuelbatista2011@gmail.com */ @Configuration @EnableJpaRepositories(basePackages = "br.edu.ifpb.blogsoon.manager.repositorios") @ComponentScan(basePackages = "br.edu.ifpb.blogsoon") @EnableTransactionManagement public class JpaConfig { @Bean @Qualifier(value = "jpaTransactionManager") public JpaTransactionManager transactionManager(EntityManagerFactory emf) { return new JpaTransactionManager(emf); } }