Hi, i have this problem because a change of the environment condition:
Actually, in an cuba application I use:
App A
postgres main db (db-A)
sql server for read only entities (table a_a, b_a, c_a)
the new scenario is to have the same app, 2 deploy, with different db and tables:
App A
postgres main db (db-A)
sql server for read only entities dbS (table a, b, c)
App B
postgres main db (db-B)
sql server for read only entities dbS (table a_b, b_b, c_b)
App A and App B are the same, Postgres engine is the same and also Sql server and Sql database are the same.
This is not the best way to manage multi tenancy, I know, but I haven’t another way to do that
Wich Is the best way to maintain 2 build of the same app with different configuration of the main db (db-A, db-B) and different table names of sql db (a_a - a_b, b_a - b_b, c_a - c_b )?
It would be nice to manage from build parameters
change main data store
change table name
@DbView
@DdlGeneration(value = DdlGeneration.DbScriptGenerationMode.DISABLED)
@Table(name = "**EXP_REF_A**")
@Entity(name = "adrapp_AnagraficaReferente")
@NamePattern("%s %s|cognome,nome")
public class AnagraficaReferente extends BaseLongIdEntity {
private static final long serialVersionUID = -7185032850139540204L;
@DbView
@DdlGeneration(value = DdlGeneration.DbScriptGenerationMode.DISABLED)
@Table(name = "**EXP_REF_B**")
@Entity(name = "adrapp_AnagraficaReferente")
@NamePattern("%s %s|cognome,nome")
public class AnagraficaReferente extends BaseLongIdEntity {
private static final long serialVersionUID = -7185032850139540204L;
Hello,
to connect to different databases and have different settings, you can use Spring Profiles
For example, you can have dev, proda and prodb profiles, then you start the application with the wanted profile.
Different table names are a bit harder, spring profiles are meant primarily for configuration.
How about using some editor macros to change the table names before the build (search and replace)?
Is it possible to have the same table and field names in both applications? Why are different names needed?
I know isn’t a good practice but I have one read only db that gives me multi tenancy information by different views name, the cuba app wasn’t design for multi tenancy, so the fast way is to duplicate the environment, but for maintenance I would like to modify main db and tables name on build moment.
I have a readonly db
Sql sbS and two different tables items_customerA items_customerB for items of tenant A and items for tenantB
Every Cuba App (App A for tentant A, App B for tenant B) has a postgres db (dbA, dbB), one for every instance (same user could be a user of both “tentant”)
So:
App A read Sql db sbS and table items_customerA and read/write (main db) on postgres dbA
App B read Sql db sbS and table items_customerB and read/write (main db) on postgres dbB
I don’t know if there is a simple, fast and better way to manage this scenario. Could be simple if at bulding moment I could set main db configuration and table name of Sql entities