So i have a situation like this:
A table T is present in two databases. In one of them T has a column C and in the other one it doesn't. My application reads at deploy time a boolean value which among other things tells it which database it must connect to.
Doing some research it looks like the potential solutions might be:
- Create two different entities and a parent with MappedSuperclass with all the common properties. One of the sublasses will have that additional column, the other would be "blank". See comments on the question here
- Create two entities and define two PersistenceUnit for each DB. Then use the schema property of @Table to specify the correct schema.
Are they correct? Any other advice? Do you know of any drawbacks?