The Cayenne docs shows how to use ServerRuntimeBuilder to register as a listener for object life-cycle events with something like this:
ServerRuntime.builder()
.addConfig("cayenne-model.xml")
.addModule(binder -> ServerModule.contributeDomainListeners(binder)
.add(MyListener.class))
.build();
How do I register for those events later, when the ServerRuntime has already been created?
After startup a listener can be added to the DataDomain directly:
ServerRuntime rt = ..
rt.getDataDomain().addListener(new MyListener());