broadleaf database tables does not persist after application shutdown - broadleaf-commerce

I have been able to run the DemoSite project after changing the in-memory HSQL database to MySql following the instructions given in the broadleaf commerce getting started instructions for changing databases .
Now when I run the Demosite application I find 183 tables get created and populated with data , but this is in existence only during the running of the application . Once the application is shut down only 4 tables remain in the database .
I am using broadleaf demosite version 4.0.0 and MySql Database . The 4 tables which remain after application shut down are named as follows : -
blc_bank_account_payment
blc_credit_card_payment
blc_gift_card_payment
blc_static_asset_strg
I have changed the relevant properties files "hbmddl2.auto" entry value to "update" so that the database tables don't get created and erased for every new run of the application but still have not been able to get rid of this issue .
I have searched a lot also posted to the relevant forums but no answer . SOF is my last resort . Please help .

When you first run DemoSite you might have blPU.hibernate.hbm2ddl.auto=create-drop in your site/src/main/resources/runtime-properties/development.properties file in order to generate database tables.
How you are running the Site/Admin? From ant tomcat target from IDE or deploying war in tomcat outside of IDE.
I hope you have changed blPU.hibernate.hbm2ddl.auto property value to update.
Now if you are running ant tomcat from IDE, after changing the above property first you need to maven install core/site/admin modules before running site/admin.
If you are running from IntellijIDEA when you stop the application it will drop the tables if you have blPU.hibernate.hbm2ddl.auto=create-drop, where as Eclipse will immediately terminates the process without running the drop phase.
The best thing to do is when you start the application first time , after database tables are created and sample data is populated then take backup of the schema. Then change blPU.hibernate.hbm2ddl.auto to update, run maven install. Now start the application.
Hope it helps.

Related

ASP.NET Core 2.0 Code First Migration - New Database

I currently have an ASP.NET Core 2.0 project and I've just implemented code first migrations to the localdb and have around 3 migrations including the initial create. I'm wondering what the correct process is to change to a new database? Is it simply a case of updating the connection string and running the below in the project directory?
dotnet ef database update
My current knowledge is based on the below Microsoft tutorial and I've been using the CLI commands.
https://learn.microsoft.com/en-us/aspnet/core/data/ef-mvc/migrations
In answer to my own question, it does appear that running the following command in the existing project directory will build a new database from scratch including all the existing migrations. As long as you update the connection string to the new database and have already implemented migrations on the existing database.
dotnet ef database update
correct process is to change to a new database
Everything depends what you mean by writing this sentence ( I am not sure what "new database" means in it) altough flow looks like this:
1. First you make initial create
2. Then you change something in your code (create some additional fields etc)
3. Then you write "dotnet ef database update" command in CLI to update your current database.

How do you tell entity framework to create / deploy a database in Azure?

I'm using Entity Framework with a code first model; I've got my InitialCreate migration setup and working locally, I can run code against my database context, and everything works.
But when I deploy my project to Azure, I just get a connection string error ("Format of the initialization string does not conform to specification starting at index 0.").
I can't seem to find where in the Publish dialog are the options to create the Azure database. -- Do I have to create the database separately and hook them up manually? -- If so, what exact process should I follow. Does the database need to have contents?
I thought Microsoft was making a big deal that this could all be done in a single deploy step, but that doesn't seem to be the case from my current experience.
When you publish your project in the publish dialog, there is an option for the code first migration in the Settings tab, it will automatically show your data context and it will give you the option to set the remote connection string, and this will add a section in web.config to specify the data context and the Migration class to run during the migration process.
It will also allow you to set if you want to run the code first Migration or not.
You can also take a backup from the dev and clear the data then upload it to Azure SQL DB, this way the code first data context will check at first connection and it will find the code an database the same

Broadleaf Running core and Admin

I am using Broadleaf for one of my project. I want to use only the admin and core module. But when I run the project I have this error " Table 'broadleaf.blc_system_property' doesn't exist". Is it possible to run the demosite without the site module. I mean just core and admin.
Thank
By default, the site application is started with this set in the 'site' application, in site/src/main/resources/runtime-properties/development.properties:
blPU.hibernate.hbm2ddl.auto=create-drop
With this setting, the following happens when you start up the site application:
Application start
All database tables are dropped
All database tables are created
The load SQL in core/src/main/resources/sql is executed
Application finishes starting up
--- Application runs for however long it runs; do cart operations, register customers, etc
Shut down application
All database tables are dropped
Application is done shutting down
In the admin application, this is set in admin/src/main/resources/runtime-properties/development.properties:
blPU.hibernate.hbm2ddl.auto=none
With that setting, this is what happens:
Application Start
Nothing happens with the database
Application finishes starting up
--- Run for however long
Shut down application
Application is done shutting down
Basically, to fix your issue you want to change it such that when you start up the admin application it also creates tables and runs the import sql. I recommend changing this to create. So in admin/src/main/resources/runtime-properties/development.properties change it to this instead:
blPU.hibernate.hbm2ddl.auto=create
With that setting, this is how the application will behave:
Application start
All database tables are dropped
All database tables are created
The load SQL in core/src/main/resources/sql is executed
Application finishes starting up
--- Application runs for however long it runs; do cart operations, register customers, etc
Shut down application
Application is done shutting down
check your database, seems like this table is not there. On Unix like systems the table names are case sensitive so if your table was created in upper case, that would be the reason why broadleaf can't find it.
Yes and it is possible to run the admin without the site. To do that, just deploy the admin.war. Core is a separate maven module that is used by both the admin and site and is packaged as a jar in the war files.

unable to see changes in database

I'm using Broadleaf Commerce 2.2 and unable to update my database with new product entry which i did from admin console. I would like to know that why my changes which i made in admin is not reflecting in database?
I added couple of new product through admin console in Broadleaf database but when i check this under database table i won't find any product there. Is there any way which i need to consider or setup??? how can i add more product from admin and see those under database?
First migrate your database from hibernateSQl to Mysql.
then you have to made one change in development.resources after starting the jetty from
blPU.hibernate.hbm2ddl.auto=create-drop
to
blPU.hibernate.hbm2ddl.auto=update
if it doesnt works then you have to setup your whole demosite in tomcat server by just delpoying the .war file of your project in tomcat webapp folder.
and do the same changes in development.properties after starting the tomcat ..
It will surely work for you.

Liferay 5.2.3 to 6.0 Upgradation steps (Windows + Tomcat + MySql)

I have taken the backup of my live portal and I want to upgrade it to newer version in localhost and then move the upgraded version to my live site.
I followed the steps in the link http://www.liferay.com/community/wiki/-/wiki/Main/Upgrade+Instructions+from+5.2+to+6.0. and my stpes are :
1) I have setup the new liferay 6.0 on my localhost
(successful installation of liferay 6.0 with inbuilt Hypersonic database )
2) I have imported MySql database of live system to the local MySql Server.
3) After stopping the tomcat server, I have changed the configuration file portal-ext.properties for the MySql database details.
4) Then, I have started the start.bat file. It is showing upgrade process well but after few minutes window is closed
Can anyone help me in this regard where I have done some mistake or am I missing something during the upgration. If anyone has some idea then please share their steps.
Thanks in advance
You don't mention that you also copy your document library / image gallery folder to the new installation. This typically (unless configured otherwise) sits in your "data" folder. Just importing the MySql database isn't enough, as it contains only the metadata for doclib & image gallery.
You'll have to take this into account for backups also - ideally you'd read about backup and set up a second 5.2.3 instance (and make sure it runs) from your backup, then start upgrading. I typically forbid to call something a backup if nobody ever demonstrated, that they can use it to successfully restore in a completely new environment. This is your chance to ultimately test your backup procedure.

Resources