[
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}
// 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();
// with JDBC parameters (a cover for CayenneDataSource.of(..))
DataNodeDescriptor dn2 = DataNodeDescriptor.of("dn2")
.dbUrl("jdbc://")
.dbUserName(..)
.dbPassword(...)
.build();
CayenneRuntime.of()
.addDataNode(dn1, "map1", "map2") // linked to maps
.addDefaultDataNode(dn2); // used by all unlinked maps
{noformat}
was:
Remove DataNode from the XML. DataNode modeling was an idea from the days of
application servers to bypass JNDI insanity. It allowed a developer to quickly
connect to a DB.
A DataNode with an explicit connection info coming from the modeler is somewhat
useful, until you have more than one environment. So it is not a production
feature. And if you have to use custom DataSourceFactory, you might as well set
it in the code.
So we are going to stop supporting DataNodes in the XML mapping, and will
instead provide a way to map DataSources to DataMaps via CayenneRuntime builder
(with DataNodes created implicitly):
{noformat}
addDataSource(DataSource ds, String... dataMaps)
addDataSource(DataSource ds, SchemaUpdateStrategy s, String... dataMaps)
defaultDataSource(DataSource ds)
defaultDataSource(DataSource ds, SchemaUpdateStrategy s)
{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}
> // 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();
> // with JDBC parameters (a cover for CayenneDataSource.of(..))
> DataNodeDescriptor dn2 = DataNodeDescriptor.of("dn2")
> .dbUrl("jdbc://")
> .dbUserName(..)
> .dbPassword(...)
> .build();
> CayenneRuntime.of()
> .addDataNode(dn1, "map1", "map2") // linked to maps
> .addDefaultDataNode(dn2); // used by all unlinked maps
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)