2

Up until this point, I've been using Spring in a development mode of sorts with hbmddl2 properties which drop all the tables and start again when I deploy the application to glassfish. It works well as a development config, since I know exactly what my database is going to contain when I run my app.

However, this isn't appropriate for an application with a rolling release cycle and I'm not exactly sure how to proceed in changing it so it would be suitable in a production environment. Googling it just gives me resources on how to update Spring or Hibernate itself, but nothing on maintaining a server. I'm getting the feeling I'm going to have to start creating XML object property mappings for Hibernate, but I think that's a little over the top when all I want to do is update a schema with new tables and new columns with default values.

Thanks in advance for any answers, I'm completely stuck on this.

  • It is not advised to use hbmddl2 properties in a production environment. Schema update should be done through scripts. See [this](http://stackoverflow.com/questions/438146/hibernate-hbm2ddl-auto-possible-values-and-what-they-do) or [this](http://stackoverflow.com/questions/221379/hibernate-hbm2ddl-auto-update-in-production) for more information – Naresh Vavilala Aug 25 '14 at 03:21
  • The problem with this is, it's a hobby project and I really don't want to get bogged down in SQL schema files if I don't have to. Hoping there's another alternative – HeadBangingSloth Aug 25 '14 at 03:51

1 Answers1

1

This question is a matter of opinion so is is very broad.

There is no best way or right way of doing it. Updating/upgrading/versioning etc. a production database is always a risk based activity where the key is to mitigate the risk as much as possible.

Here is a example answer to your question Best Practice for Updating a Production Database manually.

This is one of those areas where you gotta do your research and find the best deployment/upgrade method for you. At the end of the day you are going to be accountable for any user/customer data in your database so you have to be comfortable with the approach.

Community
  • 1
  • 1
Aeseir
  • 7,754
  • 10
  • 58
  • 107