openSession « Connection « JPA Q&A





1. Hibernate not throwing exception when openSession is called and the connection to DB cannot be established    stackoverflow.com

When I configure hibernate to connect to a DB and for some reason the connection fails, I noticed that it doesnt throw any exception neither when building the factory (which is ...

2. SessionFactory openSession(Connection)    forum.hibernate.org

3. sessionFactory.openSession(Connection) and N sess factories.    forum.hibernate.org

I've seen in other posts Gavin suggesting use of a single session factory when connecting to multiple datasources sharing the same schema and domain model. We provide the connection to our session factories openSession method in a thread local at the start of a transaction. The implications we see are: - limited to working with one datasource per tx since 1st ...

4. Session openSession(Connection connection) method usage    forum.hibernate.org

I don't see any problem with that approach until you try and use a second level cache. If you start using it, you'll have to check wheter it is attached to the sessionFactory (so that each database can be cached independently) or if it's shared, and in this case I do believe you'll have troubles with objects coming from different database ...