This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Hibernate replacing my tables

 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Why is Hibernate replacing existing tables in the database with its own, different tables upon a call to session.find("from X")?

Here's my mapping document:

Here's the class I'm mapping:

And this is what I used for creating the table before triggering the SELECT from within Tomcat:


Note that I've included a 'password' column in the database and that isn't mapped to the User class.

Finally, this is what happens when Hibernate has had a chance to do the SELECT:


I'd really appreciate any pointers towards where I'm going to the woods.

I'm using Hibernate 2.1.6 and MySQL 4.0.22.

-Lasse-
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lasse I think you have enabled the hibernate.hbm2ddl.auto property set to create-drop. This will create and drop the tables each time you create a SessionFactory. Have a look in chapter 3.5

./pope
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the tip. I had already spotted that one from the bottom of the mile-long hibernate.properties which I had copy-pasted from somewhere but forgot to post here...
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic