I was wondering where would be the best place to learn to use hibernate. I would be especially happy for help on spring integration with hibernate. I like the configuration of hibernate through spring. It makes everything much simpler.
I am relatively new to web programming, but am beginning to understand the basics. I have just read a book on the struts framework for java web apps and there was a chapter in the book on spring and java persistence with hibernate. They used hibernate in conjunction with spring to do some really cool things. For example, when the java app ran the tables were created in the db. The only problem was that the configuration they had in the book recreated the database schema each time, causing me to lose all my data after the app was restarted. Because spring was being used as well as java annotations, the configuration was very easy. The persistence.xml file was this:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd" version="1.0">
<persistence-unit name="struts2InAction">
<properties>
<property name="hibernate.hbm2ddl.auto" value="create"/>
</properties>
</persistence-unit>
</persistence>
In the book, they said take out the value attribute to stop the recreation of the db schema. When I tried to do this, however, the xml file was not consistent with the xsd and the problem was not solved. The databases were still being recreated each time.