• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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 showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic