I have an entity which retrieves its data from various tables according to how I call this entity, it is shown here : hibernate two tables per one entity which works fine for me. But how can set hibernate to call various Databases for one entity ?
According to your need where you want use multiple DBs to work on single entity. (correct me again if I am wrong)
So to work with multiple DBs in hibernate please refer links 1 and 2 as it's asked son many times on SO.
About discriminator value (discriminator-value
), I don't think it's fully possible because according to Docs 3 discriminator used for inheritance purpose.
What I understand is if you have 2 DBs having Table Student
with two joined classes BadStudent
and GoodStudent
but which database to use for work is only decided by hibernate session factory which is configured by a datasource(DB), So if you want to work on 2 DBs you have to define two datasources.
Correct me If I misunderstood your requirement or doubt.