There is a Spring Boot application, version 2.0 There is a need to write and read one and the same Entity into different schemas of the same database (PostgreSQL) using Hibernate.
What is the problem?That does not work?In fact, there are no pripyatsviy.Describe in more detail and provide the code (the entity itself, the configuration, etc.) with which the problem occurs - Chubatiy
The problem is just with the configuration, I can not understand how to paint it correctly, everything else is very standard - Andrey Gornostaev
If there are two tables, then @SecondaryTable can be used.But better do it all separately.Different schemes in fact - different databases.And if in one table something is added, and in the second it will not be necessary? - Chubatiy
|
1 answer 1
Create a base entity and describe all the fields in it. Then, for each table, create child classes, inheriting from the base entity and arrange the @Table annotations with the name and schema and table.
@SecondaryTablecan be used. But better do it all separately. Different schemes in fact - different databases. And if in one table something is added, and in the second it will not be necessary? - Chubatiy