Page 1 of 2

Product deleted on restart

Posted: Fri Oct 11, 2013 4:55 pm
by anikanchan
I have the latest BL demo code deployed. Only change I have done is to use MySQL db instead of default HSQL. The issue I am noticing is that my new products/categories are not persisted after restarting the app. Also, the new category added through admin does not show up on the site. I can search for the products added through admin on the site though, however they get deleted after restart. Any suggestion, how to fix this issue?

Re: Product deleted on restart

Posted: Fri Oct 11, 2013 6:56 pm
by anikanchan
I also see the following in my log for many of the tables:

[artifact:mvn] [ERROR] 17:36:53 SchemaExport - HHH000389: Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO drop foreign key FK3BFDBD63B5D9C34D
[artifact:mvn] [ERROR] 17:36:53 SchemaExport - Table 'galagzdb.blc_additional_offer_info' doesn't exist
[artifact:mvn] [ERROR] 17:36:53 SchemaExport - HHH000389: Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO drop foreign key FK3BFDBD63D5F3FAF4
[artifact:mvn] [ERROR] 17:36:53 SchemaExport - Table 'galagzdb.blc_additional_offer_info' doesn't exist
[artifact:mvn] [ERROR] 17:36:53 SchemaExport - HHH000389: Unsuccessful: alter table BLC_ADDITIONAL_OFFER_INFO drop foreign key FK3BFDBD631891FF79
[artifact:mvn] [ERROR] 17:36:53 SchemaExport - Table 'galagzdb.blc_additional_offer_info' doesn't exist

I do not see any such log when I use default HSQL database. Any suggestions on how to resolve this? Is this anyway related to my products getting wiped out after each restart?

Re: Product deleted on restart

Posted: Fri Oct 11, 2013 6:57 pm
by anikanchan
I have the latest head code, just to clarify. Sorry about multiple messages.

Re: Product deleted on restart

Posted: Sun Oct 13, 2013 5:55 am
by mitalicyrus
Hi,

The same happens with me. I guess it is because we restart the server. I read somewhere about using TOMCAT server and some work around this problem. Try that if it helps you. I'd love to know a solution as well.

Re: Product deleted on restart

Posted: Sun Oct 13, 2013 12:13 pm
by anikanchan
Not sure if using tomcat or any other server will resolve this issue. I am guessing it has to be hidden somewhere in some configuration file.

Re: Product deleted on restart

Posted: Sun Oct 13, 2013 4:21 pm
by zenman
Me too on the Jetty server.

Pretty frustrating, to see all the changes go away. Good loss of time.

I think there is a drop database command in the init somewhere. So that the demo can be reset.

Probably not a bad idea for a daily reset.

Re: Product deleted on restart

Posted: Sun Oct 13, 2013 5:51 pm
by anikanchan
I may have found the solution. In development-shared.properties there is a property like
blPU.hibernate.hbm2ddl.auto=create-drop, changing this to update should do the trick.

Re: Product deleted on restart

Posted: Tue Oct 15, 2013 9:43 am
by phillipuniverse
anikanchan is correct. The database starts up by default with the Hibernate ddl set to create-drop. This will drop the entire database on shutdown, then recreate the database on startup and then execute the provided data import scripts. Change this to 'update' or 'none' in order to remove this functionality.

Re: Product deleted on restart

Posted: Thu Oct 17, 2013 2:06 am
by anikanchan
Phillip,

I noticed one wierd thing after setting that property to update. If I go to http://localhost:8080/ it does not display the site and I see this error in my log:

No mapping found for HTTP request with URI [/] in DispatcherServlet with name 'mycompany'

Just by changing that property back to create-update, the site starts working just fine. What should I do to not recreate my database and still make my site work?

Re: Product deleted on restart

Posted: Thu Oct 17, 2013 10:43 am
by zenman
works for me.
I am using an external postgres database.

I think it has to be set to drop create the first time you run, to create the schema. do you see all 177 tables?

philip mentions that the database gets dropped after shutdown.