Model simplification - single file, no DataNodes?
Andrus Adamchik <[email protected]> Sat, 11 Jul 2026 16:59:08 -0400
| Newsgroups | gmane.comp.java.cayenne.devel |
|---|---|
| Message-ID | <[email protected]> |
I'd like to drastically simplify Cayenne projects:
1. 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. The big problem was that =
DataSources had to be aware of their environment, so I never used the =
built in one for instance. There are custom factories, but if you are to =
use one, you are better off calling it on your own. So I'd rather move =
everything DataNode related to the runtime builder where it belongs:
CayenneRuntime.builder()
.dataSource(defaultDS)
.dataSource(specialDS, "map1", "map2")
or even
CayenneRuntime.builder()
.dataSource(CayenneDataSource.of("jdbc:...."));
2. No multi-file projects ("cayenne-project.xml" should go away, just =
leaving DataMap files). I am still hesitant whether we should support =
more than one DataMap per XML (the only reason is cross-DM =
relationships, but that's a solid reason). For anything else, Cayenne =
has project merging facilities for a long time. So you supply multiple =
projects on startup:
CayenneRuntime.builder()
.addConfig("p1.xml")
.addConfig("p2.xml")
3. Remove ObjEntity callbacks support from XML. Just use annotations on =
entities. This is a runtime feature, not a "mapping" feature.
Thoughts?
Andrus=