Can I have two database-related session-factory tags in one hibernate.cfg.xml file?

I have two different databases where I need to dynamically connect and update tables. But it seems that I cannot save two related sessions in the configuration file. Is there any way to handle this?

+3
source share
1 answer

Well, as you noticed, the root element of the Hibernate XML configuration file should declare one and only one element <session-factory>according to the DTD:

<!ELEMENT hibernate-configuration (session-factory,security?)>

So, if you want to set up multiple session factories, follow these steps:

References

+3

Source: https://habr.com/ru/post/1773766/


All Articles