I have two different databases where I need to connect and update the tables dynamically. But it looks like I cannot keep two sessions related information in configuration file. Is there any w开发者_如何学JAVAay to handle this ?
Well, as you noticed, the root element of Hibernate's XML configuration file must declare one and only one <session-factory>
element as per the DTD:
<!ELEMENT hibernate-configuration (session-factory,security?)>
So if you want to configure multiple session factories, either:
- Use a programmatic configuration approach
- Use several
hibernate.cfg.xml
References
- Hibernate Core Reference Guide
- 3.1. Programmatic configuration
- 3.7. XML configuration file
精彩评论