Spring3.1.1 + hibernate 4.1 + Struts2 + JPA2.0 + Maven

整了一周的Spring3.1.1 + hibernate 4.1 + Struts2 + JPA2.0 集成,今天终于是大功告成了。

使用的都是几个框架中的最新版本,版本之多对集成也产生了很多奇形怪状的问题。

目前把所有的问题都解决了,添加事务的支持,不过缓存这块还没有加上,有时间了一并给加上。

注:想要使用getCurrentSession的时候,必须要打开事务哦 在service中使用@Transactional 或者 在spring配置文件中使用aop来配置,并且在hibernate的配置中加入<prop key="hibernate.current_session_context_class">

org.springframework.orm.hibernate4.SpringSessionContext</prop>。

今天太忙了,就不详尽说明了,如对此有不明白的地方或者想要代码的童鞋,请留言吧。

猜你喜欢

转载自bricklayer.iteye.com/blog/1544013