Database update problem with embbeded entity in application component

Hi,
I created an application component, let say A, with an entity E. Entity contain an embedded entity F. Application A run perfectly independently.

After then, I created another application, let say B. B declare A as application component.
When I started application B, studio asked me to update database, but the relevant columns for embedded entity F were not generated in the table for E.

As work around, I can ignore automatic update database feature of Studio and run sql commands to create these column manually, however this is not convenient for developers.

Please help this case, thanks.

Hi,

Do you use the same database type for both A and B?

When you use an app component in an application, the component’s database init/update scripts are included in the application. You should see them in the modules/core/build/db directory of the B project.

Yes, I use MS SQL for both of them.
I checked and find that the component’s database init scripts are included in B and B create database correctly.
However, when starting B, studio verifies and creates update script to DROP columns belong to embedded entity F.

Could you please provide more information about your problem? Which version of the platform and Studio do you use? If it is possible, could you share a small project in order to help us investigate the problem.

Hi Natalia,
Please see attached for samples.
Just start main app and try to work with component’s entity.
app-component.zip (84.1 KB)
main.zip (84.7 KB)

Unfortunately, we could not reproduce the problem. Could you please provide the exact reproduction scenario? Have you created databases for both components?
I tried using your demo apps, but the only script that was created is the following:

alter table APPCOMPONENT_COM_ENTITY add column EM_NOTE_NOTE varchar(255) ;

Hi,
I created projects as following:

  • Create app-component
  • Create ComEntity with an embedded entity (EmDescription) and relevant screens
  • Create main project, declare above as application component
  • Start main project, every should work well.
  • Add one more embedded entity in app-component, named EmNote and then add this to ComEntity
  • Start main project again, problem will occur.

A post was split to a new topic: Removing embedded entity columns from the table created in the App component