Roohi
Roohi

Reputation: 7

Access entity dynamically based on postgres/ sql db from springboot app based on configuration

I am building a springboot app which can connect to either sql or postgres db based on configuration. Entity for the two databases are slightly different. Is it possible to create 2 different entity for 2 databases and load them dynamically on startup based on db configuration. Or will I have to maintain 2 code bases. Let me know if more information is required.

I was thinking of creating two different entity classes with only columns that are different and they inherit from same base class. But I don’t know how to load dynamically based on db (property)

Upvotes: 0

Views: 61

Answers (0)

Related Questions