use of org.springframework.orm.hibernate4.HibernateTransactionManager in project tutorials by eugenp.
the class PersistenceConfig method hibernateTransactionManager.
@Bean
public PlatformTransactionManager hibernateTransactionManager() {
final HibernateTransactionManager transactionManager = new HibernateTransactionManager();
transactionManager.setSessionFactory(sessionFactory().getObject());
return transactionManager;
}
use of org.springframework.orm.hibernate4.HibernateTransactionManager in project trainning by fernandotomasio.
the class TestesDAO method main.
public static void main(String[] args) throws DAOException {
@SuppressWarnings("resource") ApplicationContext context = new ClassPathXmlApplicationContext("persist-context.xml");
DAOFactory factory = (DAOFactory) context.getBean("daoFactory");
NetworkGroupDAO dao = factory.getNetworkGroupDAO();
SessionFactory sessionFactory = (SessionFactory) context.getBean("sessionFactory");
HibernateTransactionManager transactionManager = new HibernateTransactionManager(sessionFactory);
Session session = transactionManager.getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
NetworkGroupDTO group = dao.findRole("OperadorLocal");
group.getMembers().add("uid=tasdfasd,ou=people");
dao.update(group);
tx.commit();
session.close();
}
use of org.springframework.orm.hibernate4.HibernateTransactionManager in project midpoint by Evolveum.
the class SqlRepositoryBeanConfig method transactionManager.
@Bean
public TransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager htm = new HibernateTransactionManager();
htm.setSessionFactory(sessionFactory);
return htm;
}
use of org.springframework.orm.hibernate4.HibernateTransactionManager in project rhino by PLOS.
the class RhinoConfiguration method transactionManager.
@Bean
// and a JmsTransactionManager.
@Primary
public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager manager = new HibernateTransactionManager();
manager.setSessionFactory(sessionFactory);
return manager;
}
use of org.springframework.orm.hibernate4.HibernateTransactionManager in project PublicCMS-preview by sanluan.
the class ApplicationConfig method hibernateTransactionManager.
/**
* Hibernate 事务管理
*
* @param sessionFactory
* @return hibernate transaction manager
*/
@Bean
public HibernateTransactionManager hibernateTransactionManager(SessionFactory sessionFactory) {
HibernateTransactionManager bean = new HibernateTransactionManager();
bean.setSessionFactory(sessionFactory);
return bean;
}
Aggregations