[
https://issues.apache.org/jira/browse/CAY-2981?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrus Adamchik updated CAY-2981:
---------------------------------
Description:
Remove DataNode from the XML. A DataNode with an explicit connection info
coming from the modeler is somewhat useful (using GUI to connect to DB), until
you have more than one environment. So it is not a production feature. And if
you go as far as using custom DataSourceFactory, you might as well set it in
the code anyways.
So we are going to stop supporting DataNodes in the XML mapping, and will
instead provide a way to create them in Cayenne runtime explicitly.
{noformat}
// 1. Simple: pass a DataSource; DataNodes with default settings will be
created implicitly
CayenneRuntime.of()
.addDataNode(ds1, "map1", "map2") // linked to maps
.defaultDataNode(ds2); // used by all unlinked maps
// 2. Advanced: use DataNodeDescriptor to configure nodes
DataNodeDescriptor dn1 = DataNodeDescriptor.of("dn1")
.dataSource(ds1)
.createSchemaIfNeeded()
.build();
CayenneRuntime.of()
.addDataNode(dn1, "map3", "map4") // linked to maps
.defaultDataNode(dn2); // used by all unlinked maps
{noformat}
was:
Remove DataNode from the XML. A DataNode with an explicit connection info
coming from the modeler is somewhat useful (using GUI to connect to DB), until
you have more than one environment. So it is not a production feature. And if
you go as far as using custom DataSourceFactory, you might as well set it in
the code anyways.
So we are going to stop supporting DataNodes in the XML mapping, and will
instead provide a way to create them in Cayenne runtime explicitly.
{noformat}
// still need a DataNodeDescriptor indirection, as DataNode references mapping
and a bunch of
// injected objects not known at construction time
// with DataSource
DataNodeDescriptor dn1 = DataNodeDescriptor.of("dn1")
.dataSource(ds1)
.createSchemaIfNeeded() // pass other preferences beyond the DataSource
.build();
CayenneRuntime.of()
.addDataNode(dn1, "map1", "map2") // linked to maps
.setDefaultDataNode(dn2); // used by all unlinked maps
{noformat}
> Remove DataNode from XML mapping
> --------------------------------
>
> Key: CAY-2981
> URL: https://issues.apache.org/jira/browse/CAY-2981
> Project: Cayenne
> Issue Type: Task
> Reporter: Andrus Adamchik
> Assignee: Andrus Adamchik
> Priority: Major
> Fix For: 5.0-M3
>
>
> Remove DataNode from the XML. A DataNode with an explicit connection info
> coming from the modeler is somewhat useful (using GUI to connect to DB),
> until you have more than one environment. So it is not a production feature.
> And if you go as far as using custom DataSourceFactory, you might as well set
> it in the code anyways.
> So we are going to stop supporting DataNodes in the XML mapping, and will
> instead provide a way to create them in Cayenne runtime explicitly.
> {noformat}
> // 1. Simple: pass a DataSource; DataNodes with default settings will be
> created implicitly
> CayenneRuntime.of()
> .addDataNode(ds1, "map1", "map2") // linked to maps
> .defaultDataNode(ds2); // used by all unlinked maps
> // 2. Advanced: use DataNodeDescriptor to configure nodes
> DataNodeDescriptor dn1 = DataNodeDescriptor.of("dn1")
> .dataSource(ds1)
> .createSchemaIfNeeded()
> .build();
> CayenneRuntime.of()
> .addDataNode(dn1, "map3", "map4") // linked to maps
> .defaultDataNode(dn2); // used by all unlinked maps
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)