java Spring 3、Hibernate 4.1 Maven 3 教程?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14353780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 15:58:47  来源:igfitidea点击:

Spring 3, Hibernate 4.1 Maven 3 Tutorial?

javaspringhibernatemavenjpa

提问by CorayThan

I'm having some difficulty figuring out how to configure my project to use Hibernate. I've created a simple webapp which uses Spring 3.2 and Maven 3. I've been trying to find a good tutorial about how to incorporate Hibernate 4.1 into this project, but can't seem to find one.

我在弄清楚如何配置我的项目以使用 Hibernate 时遇到了一些困难。我创建了一个使用 Spring 3.2 和 Maven 3 的简单 web 应用程序。我一直试图找到一个关于如何将 Hibernate 4.1 合并到这个项目中的好教程,但似乎找不到。

I need to figure out how to configure my spring-servlet.xml file and my persistence.xml file (I'd like to use the JPA specifications to run hibernate.)

我需要弄清楚如何配置我的 spring-servlet.xml 文件和我的 persistence.xml 文件(我想使用 JPA 规范来运行 hibernate。)

The Hibernate documentation http://www.hibernate.org/docsseems utterly devoid of useful information.

Hibernate 文档 http://www.hibernate.org/docs似乎完全没有有用的信息。

http://blog.springsource.org/2012/04/06/migrating-to-spring-3-1-and-hibernate-4-1/looks like it would be useful. I tried following 2.B from that, but it still doesn't explain how to set up the persistence.xml, so ...

http://blog.springsource.org/2012/04/06/migrating-to-spring-3-1-and-hibernate-4-1/看起来很有用。我尝试遵循 2.B,但它仍然没有解释如何设置persistence.xml,所以......

Anyone have any good recommendations?

大家有什么好的推荐吗?

采纳答案by Zaroual Mohamed

you can find herea good tutorial to start over scratch with Hibernate Spring and Maven frameworks.

你可以在这里找到一个很好的教程,从头开始使用 Hibernate Spring 和 Maven 框架。

And there is other tutorials on the same websitejust to discover.

同一网站上还有其他教程只是为了发现。

回答by Fabio Benedetti

I used to implement this configuration (Spring 3.1 + Hibernate 4) at this article: Migrating to Spring 3.1 and Hibernate 4.1

我曾经在这篇文章中实现了这个配置(Spring 3.1 + Hibernate 4): Migrating to Spring 3.1 and Hibernate 4.1

With some little changes, it worked for me.

有一些小的变化,它对我有用。

回答by B J

Not sure...what are the exact issues that you are facing...but have you looked at this article http://www.cavalr.com/blog/Spring_3_and_Hibernate_4_Example, it specifically talks about the Spring 3 and Hibernate 4 integration and sample code included in the article uses maven, so it may help and there is an example for annotation based integration too on that site.

不确定……您面临的确切问题是什么……但是您是否看过这篇文章http://www.cavalr.com/blog/Spring_3_and_Hibernate_4_Example,它专门讨论了 Spring 3 和 Hibernate 4 集成以及文章中包含的示例代码使用 maven,因此它可能会有所帮助,并且该站点上也有一个基于注释的集成示例。