On Aug 12, 2011, at 11:31 AM, Aristedes Maniatis wrote: > I like it in the Modeler because it exposes the functionality to users very > clearly.
This is my concern as well. But my point is that once you become comfortable enough with Cayenne to use it for something more advanced, it becomes useless. Specifically different applications very often reuse the mapping, but not the listeners. Again, I am fine with mapping DataObject callbacks in the Modeler. > And they are part of OR mapping, otherwise they wouldn't be part of Cayenne > at all. The keyword here is "mapping". Cayenne is mapping + runtime framework. I think listeners belong in the later category, as they are not about mapping the DB structure, but rather about business logic and application workflow. I think this taking them out of the Model (at least the global ones for now) will underscore a separation of the application layers - Cayenne manages DataObjects, so you can map a callback method of a DataObject via Modeler. Cayenne DOES NOT manage objects implementing business logic, but provides extension points for them to act on Cayenne events. BTW listeners can be pretty complex objects that require certain app dependencies that are not available in the Cayenne DI container (but may be available from the app container such as Spring or Guice). So I think we can present an even better picture of the event system to the end users with this approach. > 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. Let's not even go there :-) Andrus
