-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Learning Hibernate
PostPosted: Fri Jun 24, 2011 9:20 am 
Newbie

Joined: Fri Jun 24, 2011 9:07 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.