cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Multiple data nodes to be selected at run time
Date Tue, 24 Apr 2012 07:13:40 GMT
Hi Tobias,

If I understand you correctly, at any moment in time each application would only access a
single database. Those databases are different from environment to environment, but still
it is always 1 database per application. In this case I wouldn't bother with multiple DataNodes.
Those exist for a different purpose. Rather figure out a way to configure appropriate database
connection *outside *Cayenne. There are a few ways of doing that:

1. By using JNDI (so the DataSource configuration, such as DB URL and login are stored in
the web container)
2. In Cayenne 3.1 it is possible to setup DataSource properties via Java startup parameters,
so in each environment you would use parameters specific to the desired DB. E.g.:


I am actually using the combination of the 1 & 2 - map the DataNode to use JNDI. Configure
JNDI in QA and production, but use properties like above when developing locally in Eclipse
in the absence of JNDI.


On Apr 23, 2012, at 7:14 PM, Tobias Wolff wrote:
> Hi,
> we are working with Cayenne in a small team. Each of the team members has its own local
environment as well as we do have a staging and a production server - again having it's own
environments. Ideally, I would want to have only one DataDomain with one DataMap and multiple
DataNodes of which I can select the right one at run time. Is this doable?
> Currently, multiple Cayenne configurations each having one DataDomain with one DataMap
and one DataNode which is quite unfortable to handle.
> Gruß/Regards,
> Tobias.
> *Adternity GmbH*
> Kennedydamm 1
> 40476 Düsseldorf
> Tonhallenstraße 16
> 47051 Duisburg
> Tel.: +49 203 298685 37
> eMail:
> Web:
> Geschäftsführer: Thomas Servatius, Jörn Mika, Tobias Wolff
> Amtsgericht: Düsseldorf, HRB 60031
> Steuer-Nr.: DE238773677

View raw message