Page 1 of 1

right way to make updates

Posted: Wed Sep 10, 2014 9:47 am
by josephmak
Hi there

I am experimenting with the BroadLeaf demo and try to make some changes to the site,
I notice that the most reliable way is to stop-all then restart the jetty-demo ant tasks.

For simple html changes, maven install will do the trick, but more complex things such as tweating the xml configuration files, maven install just don't reflect the changes.

The "problem" with restarting jetty is that it will wipe out the database, and I know about hibernate.hbm2ddl.auto property should be changed from 'create-drop' to 'update'... but unfortunately sometimes the app won't start at all if I change to 'update'.

What's the right way to make changes that preserve the database structure (and data)?

Re: right way to make updates

Posted: Sat Sep 13, 2014 1:49 pm
by phillipuniverse
For simple html changes, maven install will do the trick, but more complex things such as tweating the xml configuration files, maven install just don't reflect the changes.


True, the XML configuration updates will not be reloaded. This is because Broadleaf is kind of hijacking the Spring XML merge process by combining all of the XML into 1 big XML file and then presenting that to Spring. This combination process only happens on startup. We realize that this is a pain point and we are going to be investing in ways to make this better, likely with Broadleaf 3.3+.

The "problem" with restarting jetty is that it will wipe out the database, and I know about hibernate.hbm2ddl.auto property should be changed from 'create-drop' to 'update'... but unfortunately sometimes the app won't start at all if I change to 'update'.


If you just change to update after create-drop, it does not execute all of the SQL load scripts located in development-shared.properties. One thing that I usually do is set my Hibernate DDL to 'create', start up and have it execute all of the load scripts, shut down, then change the DDL to 'update'. That should set you up for continual development without fear of all of your data getting wiped out.

What's the right way to make changes that preserve the database structure (and data)?


I think I answered your question above, but one other point I want to make. For production updates, we strongly recommend a versioned database approach using something like Liquibase (http://www.liquibase.org/) which we use and like a lot or FlywayDB. You can use these tools in development but sometimes it adds more process than is really necessary until you get into production.