quick updates and cleanup

This commit is contained in:
eugenp 2014-01-02 17:33:10 +02:00
parent b08f53ce48
commit 361343211b
3 changed files with 9 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import java.util.Properties;
import javax.sql.DataSource;
import org.apache.tomcat.dbcp.dbcp.BasicDataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -53,9 +54,10 @@ public class PersistenceConfig {
}
@Bean
public HibernateTransactionManager transactionManager() {
@Autowired
public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) {
final HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory().getObject());
txManager.setSessionFactory(sessionFactory);
return txManager;
}

View File

@ -188,7 +188,7 @@
<!-- persistence -->
<hibernate.version>4.3.0.Final</hibernate.version>
<mysql-connector-java.version>5.1.27</mysql-connector-java.version>
<mysql-connector-java.version>5.1.28</mysql-connector-java.version>
<tomcat-dbcp.version>7.0.42</tomcat-dbcp.version>
<!-- logging -->

View File

@ -5,6 +5,7 @@ import java.util.Properties;
import javax.sql.DataSource;
import org.apache.tomcat.dbcp.dbcp.BasicDataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -53,9 +54,10 @@ public class PersistenceConfig {
}
@Bean
public HibernateTransactionManager transactionManager() {
@Autowired
public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) {
final HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(sessionFactory().getObject());
txManager.setSessionFactory(sessionFactory);
return txManager;
}