I have a web application running on Java 6, Spring 2.5.6 and Hibernate 3.2.7. Now there is a requirement to fetch some data from several databases, whose names are not known before the runtime. What is the best way to achieve this?
I have looked e.g. into the article at http://blog.springsource.com/2007/01/23/dynamic-datasource-routing/, but that seems to be applicable only in a situation, where all the database configurations are known beforehand.
It represents the classname of a custom ConnectionProvider which provides JDBC connections to Hibernate. It is used to set the JDBC transaction isolation level. It enables auto-commit for JDBC pooled connections.
Hibernate and JPA-based applications do not eliminate the need for JDBC. When you use Hibernate, all database interactions still occur with the JDBC APIs. Hibernate and JPA are actually built on top of the JDBC API.
Configuration represents an entire set of mappings of an application's Java types to an SQL database. The org. hibernate. cfg. Configuration is used to build an immutable org.
You can do configuration in Java code, so you can do it at runtime:
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/session-configuration.html#configuration-programmatic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With