简体   繁体   English

学习资源,用于在带有MySQL的Tomcat Apache上将Hibernate配置为JPA 2.0提供程序

[英]Learning resource for configuring Hibernate as JPA 2.0 provider on Tomcat Apache with MySQL

I am trying to created a new java project. 我正在尝试创建一个新的Java项目。 I have tried various examples available on the web but my project works sometimes and doesn't rest of the time. 我尝试了各种可在Web上使用的示例,但是我的项目有时可以正常工作,而并非所有时间都是如此。 It seems that there happens some error which is not thrown when hibernate is doing a secondPassCompile() after creating factory.Can someone tell me a good resource to follow or give me some pointers on where I might be going wrong? 似乎在创建工厂后hibernate执行secondPassCompile()时不会发生某些错误,有人可以告诉我一个很好的资源来跟踪还是给我一些可能会出错的地方的提示吗?

Is there any particular reason for using Tomcat? 使用Tomcat是否有任何特殊原因? If you are trying to learn Eclipse with Hibernate as the JPA implementation, I would suggest you use JBoss as the app server. 如果您尝试使用Hibernate作为JPA实现来学习Eclipse,建议您使用JBoss作为应用服务器。 That way you can learn EJBs along the way if you prefer. 这样,您可以根据需要学习EJB。 If you want to learn just Eclipse and JPA there is no need to use any server - JPA can be practised just in JavaSE. 如果您只想学习Eclipse和JPA,则无需使用任何服务器-JPA可以仅在JavaSE中进行实践。

EDIT: Recently I had to create a simple JPA project. 编辑:最近我不得不创建一个简单的JPA项目。 This is what I did: Create a new Java Project in eclipse. 这就是我所做的:在eclipse中创建一个新的Java项目。 Download Hibernate 3.6.1 from http://www.hibernate.org/downloads . http://www.hibernate.org/downloads下载Hibernate 3.6.1。 From the download directory take the Hibernate.jar and from the jpa directory take the one jar there. 从下载目录中获取Hibernate.jar,从jpa目录中获取一个jar。 Take all the jars from lib\\required. 从lib \\ required获取所有jar。 Add the above to your buildpath. 将以上内容添加到您的构建路径中。 Add logback jars - classic and core jars. 添加logback jar-经典jar和核心jar。 For the database I used HSQLDB. 对于数据库,我使用了HSQLDB。 Just one jar hsqldb.jar. 只需一个jar hsqldb.jar。 Thats it! 而已! Enjoy JPA from here onwards. 从这里开始享受JPA。

I have found the slides at http://www.coreservlets.com/ very useful when trying to get up to date with EJB3/Hibernate and JSF. 当尝试了解EJB3 / Hibernate和JSF时,我发现http://www.coreservlets.com/上的幻灯片非常有用。 Complete and yet simple enough that you do not get ovewelmed by pages and pages of sample code. 完整而又足够简单,以至于您不会被页面和示例代码的页面所困扰。 I wish they had something like that for MFC. 我希望他们对MFC有类似的东西。

They have materials about Hibernate, I would definitely look at them. 他们有关于Hibernate的材料,我一定会看一下。

About the JBoss issue, it is interesting if you plan to go into EJB3 later. 关于JBoss问题,如果您计划以后再使用EJB3,将会很有趣。 It is not difficult to have a basic configuration working and, on top of that, it is based in Tomcat. 具有基本配置并不难,最重要的是,它基于Tomcat。

That said, if you are new to Hibernate, I would definitely test it first in JavaSE and then later go with it in a server (Tomcat or whatever). 就是说,如果您是Hibernate的新手,我肯定会先在JavaSE中对其进行测试,然后再在服务器(Tomcat等)中进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM