2

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:

  1. 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
  2. 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?

1 Answer 1

2

Both solutions are fine. Do whatever works best for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.