How do you configure ColdFusion 9's ORM to use multiple DSNs if possible?
Is is possible to setup the datasource in the context of a session scope instead of the application scope?
Or how, in CF9, do you configure Hibernate to use multiple DSNs?
Looks like I should be more specific... I'm looking for a solution that allows for specifying a DSN based on the session.
Here's the scenario. We have a single custom built application that uses multiple DSNs which are determined from the sub-domain. So someone accessing from http://abc.domain.com would use the abc DSN where as someone visiting the xyz.domain.com would use the xyz DSN. The name of the DSN is determined when the session is created and it is stored as a session variable.
I'd like to do something like this:
//Artists.cfc
component persistent="true" datasource="#session.dsn#"
{
property name="artistid" generator="increment";
property firstname;
property lastname;
property address;
property city;
property state;
}
// Application.cfc
component output="false" {
THIS.name = "MultipleDsnORMTest";
THIS.applicationTimeout = createTimeSpan(0, 0, 0, 0);
THIS.clientManagement = false;
THIS.datasource = ""; // Leaving black ==> "No data source specified."
// Setting to cfbookclub ==> "ORM is not
// configured for the current application."
// Setting to cfartgallery works but doesn't
// demonstrate use multiple DSNs
THIS.loginStorage = "cookie";
THIS.sessionManagement = true;
THIS.sessionTimeout = createTimeSpan(0, 0, 0, 0);
THIS.ormenabled = true;
THIS.ormsettings = {};
}