wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Question about example in Hibernate Made Easy book - CrudRunner.retrieve() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Question about example in Hibernate Made Easy book - CrudRunner.retrieve()" Watch "Question about example in Hibernate Made Easy book - CrudRunner.retrieve()" New topic
Author

Question about example in Hibernate Made Easy book - CrudRunner.retrieve()

Cassy Thomas
Greenhorn

Joined: Sep 06, 2012
Posts: 1
Never Mind!!! I had copied a hibernate.cfg.xml from the Hibernate distribution and the configuration file had the property hibernate.hbm2dll.auto set to create-drop. I commented out this property and it worked.

***************************************************

Hello, I'm working through the examples in the book, "Hibernate Made Easy". I'm having some odd behavior with the example.

Essentially, I have two simple classes outlined below. One is an Annotated Entity class and the other is a simply example that will allow you to create a User record and retrieve it. The create works, however the retrieve is deleting all the records from the corresponding table. I know the code in the book uses Hibernate 3.5, but I didn't think it would be this much of a difference. Can anyone help me understand why? I commented the line that is causing the problem in the second class below. I used debug through Eclipse to find out which statement was deleting all the records.

Many thanks,

This is my persisted object.


This is the example class that executes attempts to create a copy of my object in the MySql database and retrieve it for display.



I am using Hibernate 3.6.Final
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about example in Hibernate Made Easy book - CrudRunner.retrieve()
 
Similar Threads
How to persist an Object
multiple value with persistence API
Hibernate caveats, best practices and performance tuning
query.list() and query.uniqueResult() in hibernate return null
Hibernate - How to retrieve data from the database