Hibernate Persistence

Greetings,

I've been trying to add a persistance layer to a web app I'm building with Hibernate, but have found the entire process more difficult than I would have previously thought. I'm using Exadel Studio Pro to do this. I would like to learn quickly how to store a POJO in a database and retrieve it later.

I am using MySQL as a database on OS X and running Tomcat v5.5 as my web container. I have configured MySQL correctly and have managed to use Quantum DB in eclipse as well as CocoaMySQL and MySQL Administrator / Query browser to successfully connect to the database and make the appropriate tables. My final issue is in actually writing to the database with hibernate and later retrieving the data. I have found this tutorial to be helpful:

www.exadel.com/exadelstudio/ gs/JSFHibernateGettingStarted.pdf

This PDF shows you a sample JSF application without persistence and then adds a Hibernate persistence layer with Exadel Studio Pro which communicates with an HSQLDB database. I was hoping to get the project working with MySQL. I have followed through the steps and for the most part am certain that I've followed the steps as they should be performed to write to a MySQL database. I am confused with the final step where the tutorial explains how to set up an application server and run the application. Does anyone know how I might do this with MySQL?

If anyone can think of a better approach to understanding hibernate persistence I am all ears.

I feel I've fallen into some conceptual misunderstanding concerning what I need to understand to make this hibernate persistence layer work. I've only been messing around with JSF for a short time and have enjoyed the experience thus far, thanks in no small part to the helpfulness of this forum.

Any help in this matter would be greatly appreciated.

[1869 byte] By [mon.goosea] at [2007-11-27 10:08:27]
# 1

If you have it working with HSQLDB then you are almost there. You need to do the following:

- change the Hibernate configuration to use MySQL (consult the Hibernate documentation, I'm sure there are examples for MySQL)

- if you were using Tomcat data sources before you need to configure a data source for MySQL (consult Tomcat documentation)

RaymondDeCampoa at 2007-7-13 0:44:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I have not tried the application with HSQLDB as I was hoping to follow the steps with MySQL. I think the hibernate configuration for MySQL is pretty straightforward so I assume that I have this part right.

I am stuck on what to do lastly. I'm not sure how to integrate this application with Tomcat. Normally, I would run a JSF application on Tomact from within eclipse by running run-as -> run on server.

In my browser I can then access the pages correctly by using the correct http://localhost:8080/appName

Of course, this isn't as straightforward with a hibernate enabled application, so what is my next step?

mon.goosea at 2007-7-13 0:44:56 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...