Yes, this behaviour is designed, and yes, using wrapperFactory is the way to force an event to fire.
The framework doesn't use AspectJ or any other bytecode mangling stuff, so when you call a setter (without the wrapper factory) then it's just a regular method invocation. Wrapping the target entity puts the wrapper/proxy in place, invoking the action/editing the property "as if" through the UI. In terms of rationalizing this, I think of it in terms of trust boundaries - if client and target are in the same module, then there's an implicit trust between the two, and there's also a responsibility of the caller to ensure that any of the target's invariants are satisfied. - if client and target are in different modules, then there's no trust, and so the client should wrap its target first. I know that Oscar would like wrapping to happen all the time, and I quite like that idea too (I think Oscar wraps all object interactions as a matter of course, irrespective of if its inter- or intra-module). If we go with my idea of automatic wrapping for inter-modules, but no wrapping otherwise, then it will require more formality/infrastructure around the concept of what a module actually is, and I at least don't really have all that straight in my head yet. The major downside is that the only way that the wrapper has to indicate that an invariant is not satisfied is by throwing an exception, which is not ideal. HTH Dan On Fri, 9 Dec 2016 at 12:43 Erik de Hair <[email protected]> wrote: > Hi, > > I've registered a property domain event for some property for which the > setter is called by an action (exposed in the wicket viewer) calling > another service that eventually calls the setter. The subscriber doesn't > catch the property event. > > EntityA.actionA(){ > service.methodX(); > } > > Service.methodX(){ > EntityB.setPropertyWithRegisteredEvent('foo'); > } > > EntityB.setPropertyWithRegisteredEvent(String bar){ > > } > > Am I doing something wrong or is this behaviour as designed? Wrapping > the setter-calling entity using wrapper factory does the trick. Is this > necessary and at what level should I do the wrapping? > > Erik >
