Forums Register Login

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

+Pie Number of slices to send: Send
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
Beauty is in the eye of the tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1099 times.
Similar Threads
multiple value with persistence API
How to persist an Object
Hibernate caveats, best practices and performance tuning
query.list() and query.uniqueResult() in hibernate return null
Hibernate - How to retrieve data from the database
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:50:36.