Hello,
Our old large web application uses one database and there are a large number
of DataContext.createDataContext(); statements all over the web application
itself and jars it depends on.
Now there is a need to access another database. Currently the Configuration
gets initialized with the first call of createDataContext - there is no
special class which initializes cayenne eagerly. All defaults.
Reading the API (
http://cayenne.apache.org/doc30/api/org/apache/cayenne/access/DataContext.html#createDataContext%28%29)
there is a sentence:
"Factory method that creates and returns a new instance of DataContext based
on default domain."
What is the default domain? I can't find anything in the modeler or in the
cayenne xml configuration file to mark one node as default.
Currently the cayenne.xml comes from one of the external jars, not the web
application itself. Now I will have to create a manually crafted
my-cayenne.xml configuration file which has another data node and initialize
it with something like:
DefaultConfiguration conf = new DefaultConfiguration("my-cayenne.xml");
But I suspect I would have to find all occurances of createDataContext() and
replace it with createDataContext("old-node-name"). I would really like to
avoid that!
Instead, can I just leave the access code to "old" database as is and only
create data context for the new database with
createDataContext("my-new-node-name")?
-Borut
This archive was generated by hypermail 2.0.0 : Mon May 03 2010 - 07:27:26 EDT