Hi all,
I’m a newbie in hibernate and currently I’m trying to find some good book, tutorial or how -to material to learn how to create a Web Project with Hibernate in Eclipse environment. Until now I found several tutorials but they are tool old (2004) or they do not work properly, I think that because the authors does not mention details and they do not provide the binary file of their applications, further more in the comments of the materials a lot of guys asks for details how to assemble the whole application, but without any responses from the authors. I just want to create a good article from community to community guys and to post it into some educational portals.
The technologies and products that I’m using in my web project are:
Eclipse Galileo + JBoss tool 3.4
MySQL 5.1
JBoss 6.0.3
Hibernate 3.0
JSP + Servlet + EJB 3.0
My first question is – are there any inconsistences when I’m using Jboss 6.0.3 and Hibernate 3.0 and Eclipse Galileo + JBoss 3.4. And what landscape set up you would recommend me for educational purpose?
My second question is what would be the architecture of this type of application? I saw in one tutorial this “architecture”:
1.Utility Project – contains .har file which consists of hibernate.cfg.xml, hibernate.reveng.xml, service-hibernate.xml and some reverted pojo files.
2. Dynamic Web application – this project is build time link with the Utility Project. The project contains some JSPs, Servlets and stateless and stateful java beans.
3. EAR File – This file should contain the Dynamic Web app’s .war and . jar files and the Utility Project .har file.
I tried several times to create an application but I did not succeed. First I created a “Utility Project” with hibernate.cfg.xml that links the project with my schema in the MySQL. So far everything works well. After the link I’m riveting the db schema with Hibernate revert tool and the tool successfully created some files in my project. Also I’m creating an service-hibernate.xml for the SessionFactory resolving from the JNDI. I saw that after version 5.0 of JBoss AS were introduced a new framework Virtual Deployment Framework which enables the capability to resolve the SessionFactory from the JNDI.
My next question is how to create a .har file from this utility project and is this the right way for creating a “hibernate application”?
My next step is to create a “Dynamic Web Project” and EAR project for the deployment. The dynamic project has a build time reference to the Utility Project. I need this link because of the pojos file. So far everything is fine, but when I’m exporting the ear file, it does not contain the .har file or any file from the Utility project. I suppose that the reason is that I have only build time reference instead of deploy time reference.
My question is do I need to create a .har file and import it into the .ear file, or just to put the hibernate files into the .ear file?
I thing that if I found answers for these key-stones question, I could prepare a good article.
Every help or suggestion for good and working materials is appreciated!
Before decided to post this new topic, I’ve searched for similar topics in different portal and tried some example from this resources:
http://www.packtpub.com/article/develop ... ibernate-1http://www.wikihow.com/Generate-Hiberna ... -DB-Tables http://www.laliluna.de/articles/first-h ... orial.html book - JBoss AS 5 Development Dec 2009
book - JBoss Tools 3 Developers Guide Apr 2009