You don't need a separate model, you just need to override the database connection information in the DataNode on startup.
See here: http://cayenne.195.n3.nabble.com/Multiple-data-nodes-to-be-selected-at-run-time-td3932923.html On Tue, May 15, 2012 at 4:59 PM, Tony Giaccone <t...@giaccone.org> wrote: > > > So here's my situation. I'm building a framework, where I'd like to let my > development team choose to use either sql light or postgres on a shared > server as the persistent store. > > Using SQLite lets them do development locally with out having to install > Postgress on each workstation and or be dependent on a central shared > postgres server. > > My first thought was to create two different models and then pick one in > the web.xml file. I'm sure this would work, but the model name would have > to be different for each model, so as to avoid file name collision. I'm not > really keen on that idea, because the models are the same and vary only in > the values in the data node. And then I thought I could put them in > different folders, which represented the datanode file. > > resources/sqlite/myCayenneModel.xml > resources/postgres/myCayenneModel.xml > > But it's not clear to me, how that is handled in the web.xml file. The > filter name is the name of the model, no? How do you manage that if the > model is not at the top level of the classpath? > > After thinking about it, it seems to me the best solution is to ask you > all. > > Just to be pedantic here's the problem. > > I have two different data models which essentially different only in the > value of the data node. > I want to be able to choose one model at compile time. > I don't want to have to change any java code to make the choice. I'd > prefer to just edit the web.xml file. > > > Anyone have a solution? > > > Tony Giaccone