Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To indicate that a property or field contains an entity they should be annotated with a @ReInject a @UIReInject annotation.:

Code Block
public abstract class CdbFormPage<T extends AbstractBaseEntity> extends SubPage {
    @UIReinject
    private T model;

The subpage injector

The SubPageInjector class is responsible for checking everything related to SubPage data. It contains a list of ISubpageInjectorFactory instances, and each instance scans the SubPage class for properties or fields that might need manipulation. The default injectors scan for fields that contain entities, but you can easily add more by implementing a factory and adding it to the default SubPageInjector (obtained from DomApplication.getSubpageInjector()).

...

When the server is running in Development mode the injector will add injections for all fields, even the unannotated and unsuitable ones to make sure that none of them contain entities. If the checking injector detects an uninjected field containing an entity it will throw a SubFieldInjectionException describing the problem. This usually means that you either have to fix whatever prevents injection, or you need to explicitly specify @ReInject(false) to indicate you accept the fact that the field contains a reference inside another QDataContext (Session).:

Code Block
public abstract class CdbSubListPage<T extends AbstractBaseEntity,P> extends CdbListPage<T> {
    @UIReinject(false)
    private P parentModel;