I am in favor of not having per-DataMap listener scope, just to keep things simple. So having per-DataDomain (aka global) scope and per-ObjEntity (or set of entities) scope seems sufficient.
Now the Modeler support. I don't know about others, but to me listeners don't belong in the mapping at all. Callbacks on DataObjects - yes, but listeners are classes with business logic not related to OR mapping. So my vote would be to kill the "Listeners" tab for DataMap (which we have to do anyways), but do not add an equivalent under DataDomain. Also consider that if we do add listener mapping under DataDomain tab, the listener XML would have to go into *-cayenne.xml file now, and that seems like a bad idea. Andrus On Aug 11, 2011, at 7:58 PM, Dzmitry Kazimirchyk wrote: > On 08/11/2011 10:35 AM, Dzmitry Kazimirchyk (JIRA) wrote: >> Per DataMap listeners are called for all entities in DataDomain >> >> Listeners assigned to DataMap in *.map.xml are registered as >> defaultListeners in EntityResolver which means that they are called for each >> entity in DataDomain regardless of their DataMap. >> > Do we need a DataMap listeners in Cayenne? > What we have now as DataMap listeners are actually global listeners. And > there were no complains about this before. So can we just switch to global > listeners instead of implementing them for DataMap? > > I've just committed CAY-1599 and now global listeners can be registered using > annotation api. So about this: should we completely remove DataMap listener > registration from the modeler or maybe move it to DataDomain level? > > Any opinions on this? >
