I’ve to use more than one database together (on the same connection… ) via mysql. I want to use hibernate, but all I can find around is to use two sessionfactories. Now the problem is: how can I do mappings like one-to-many among different sessionfactories… seems not possible as I have to put mapping in one configuration and I can’t spread it … Any suggestion?
Share
You might use Hibernate Shards
https://www.hibernate.org/429.html
Here is some quick info
Pros: A pre-made solution.
Cons: Not appropriate for large numbers of schemas since there is effectively one SessionFactory per database user/schema.