Andrus Adamchik created CAY-2981:
------------------------------------
Summary: 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
Fix For: 5.0-M3
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}
Let's also create builders for the built-in DataSource:
{noformat}
// build from explicit DB info
DataSource ds =
CayenneDataSource.of("jdbc:....").username(..).password(..).build();
// build from properties - backwards compatibility, but requires an explicit
call
DataSource ds = CayenneDataSource.fromProperties();
DataSource ds = CayenneDataSource.fromProperties("nodename");
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)