0

I am running into some serious issues with hibernate. It is dropping! my tables. Digging through the logs I find these two lines of code

    Hibernate: drop table if exists REFERENCES
    Hibernate: drop table if exists ACCOUNTS

Now whatever might be the difference in entity specifications, I would expect Hibernate NOT to drop my table. Besides this, in my experience I have found that it is RANDOMLY dropping data and altering it inside database as well.

Now this obviously [as apparent] a serious issue. How do I prevent hibernate from altering my SQL schema? Id rather have it throw fatal exceptions than screw up my database!

Kara
  • 6,115
  • 16
  • 50
  • 57
Ace
  • 1,501
  • 4
  • 30
  • 49

2 Answers2

2

I think changing the spring.jpa.hibernate.ddl-auto property would solve your problem.

Setting it to validate or update would work as you want it to from what I can understand.

Check out this answer for more information.

sugar.king
  • 46
  • 1
  • 5
2

Changing the spring.jpa.hibernate.ddl-auto = update will prevent from automatically dropping the table on each run. For me it was set to create.