JPA using multiple database schemas

前端 未结 6 1032
花落未央
花落未央 2020-12-01 05:13

I\'m having a bit of trouble with one particular issue using JPA/Spring:

How can I dynamically assign a schema to an entity?

We have TABLE1 that belongs to s

6条回答
  •  遥遥无期
    2020-12-01 05:58

    One thing you can do if you know at deployment is to have 2 orm.xml files. One for schema1 and one for schema2 and then in the persistence.xml you have 2 persistence-units defined. Putting annotations is an anti-pattern if needing to change things like schema

提交回复
热议问题