cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <>
Subject Re: [jira] [Created] (CAY-1598) Per DataMap listeners are called for all entities in DataDomain
Date Fri, 12 Aug 2011 08:31:56 GMT
On Fri Aug 12 17:37:36 2011, Andrus Adamchik wrote:
> 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
> 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?

I like it in the Modeler because it exposes the functionality to users 
very clearly. And they are part of OR mapping, otherwise they wouldn't 
be part of Cayenne at all. Sure you could instead add listeners using 
some sort of notation/injection in the code, but Hibernate people would 
say that the entire model could be described in that way.


Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

View raw message