Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1509

Lifecycle event annotations support

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1M1
    • 3.1M2
    • Core Library
    • None

    Description

      Add annotations for lifecycle events:

      @PrePersist, @PostPersist, etc. (all the standard ones, total of 8 annotations)

      Each annotated method can process events for preset collection of entity classes and/or a set of unknown entity classes tagged with a custom annotation. In the later case a listener is cleanly decoupled from specific entities (this feature is mixin-inspired). E.g:

      @Target(METHOD) @Retention(RUNTIME)
      @PrePersist {
      Class<? extends Persistent>[] entityTypes();
      Class<? extends Annotation>[] entityAnnotations();
      }

      LifecycleCallbackRegistry API:

      /**

      • This form of listener registration is very simple and type-safe compared to other forms available in 3.0 LifecycleCallbackRegistry.
        */
        public void addListener(Object annotatedListener);

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            andrus Andrus Adamchik
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment