Multiple nodes is no problem.
In 3.1 you use a custom DI module that looks something like this:
import org.apache.cayenne.configuration.DefaultRuntimeProperties;
import org.apache.cayenne.di.Binder;
import org.apache.cayenne.di.Module;
public class AppModule implements Module {
public void configure(Binder binder) {
binder.bindMap(DefaultRuntimeProperties.PROPERTIES_MAP)
.put("cayenne.jdbc.driver.MyDomain.mynode", "org.postgresql.Driver")
.put("cayenne.jdbc.url.MyDomain.mynode",
"jdbc:postgresql://localhost/my_db")
.put("cayenne.jdbc.username.MyDomain.mynode", "postgres")
.put("cayenne.jdbc.password.MyDomain.mynode", "mypassword");
}
}
}
However I think the property names have changed and this is no longer
correct.
In 3.0, it's something like this:
Configuration configuration = Configuration.getSharedConfiguration();
DataDomain dataDomain = configuration.getDomain();
DataMap dataMap = dataDomain.getMap("my map name");
DataNode oldNode = dataDomain.getNode("old node name);
DataNode newNode = dataDomain.getNode("new node name);
oldNode.removeDataMap(dataMap);
newNode.addDataMap(dataMap);
dataDomain.reindexNodes(); // maybe
On Mon, Apr 23, 2012 at 11:14 AM, Tobias Wolff <[email protected]>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: [email protected]
> Web: http://www.adternity.net
>
> Geschäftsführer: Thomas Servatius, Jörn Mika, Tobias Wolff
> Amtsgericht: Düsseldorf, HRB 60031
> Steuer-Nr.: DE238773677
>