Uploaded image for project: 'Spring Data Neo4j'
  1. Spring Data Neo4j
  2. DATAGRAPH-335

No ApplicationEvent in advanced mapping mode

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: CORE
    • Labels:
      None
    • Environment:
      <spring.version>3.2.1.RELEASE</spring.version>
      <spring.data.neo4j.version>2.2.0.RELEASE</spring.data.neo4j.version>
      <neo4j.version>1.9.M04</neo4j.version>

      Description

      No BeforeSaveEvent, AfterSaveEvent and DeleteEvent are sent when NodeBacked entities are used. This is also the case when related entities are cascaded (create and update).

      The AuditingEventListener isn't triggered because of this, thus e.g. @CreatedDate can't be used on entity fields.

      @Configuration("db")
      @EnableNeo4jRepositories(basePackages = { "com....repository" })
      @EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
      @Profile(SpringProfile.COMMON)
      public class DatabaseSpringConfiguration extends Neo4jAspectConfiguration {
       
          @Bean
          public AuditingEventListener auditingEventListener() throws Exception {
              return new AuditingEventListener(new IsNewAwareAuditingHandler<Object>(isNewStrategyFactory()));
          }
      }

        Activity

        Hide
        tims83 Timmy Storms added a comment -

        Small remark: it probably makes sense to only change a LastModifiedDate when a given value is not equal to the old value when a setter is used.

        Show
        tims83 Timmy Storms added a comment - Small remark: it probably makes sense to only change a LastModifiedDate when a given value is not equal to the old value when a setter is used.
        Hide
        mhunger Michael Hunger added a comment -

        It's tricky as changes are propagated automatically on tx.commit, and for some entities you might not get a notification that it was changed. Only for the entities that were actually called with save we could do that automatically.

        Show
        mhunger Michael Hunger added a comment - It's tricky as changes are propagated automatically on tx.commit, and for some entities you might not get a notification that it was changed. Only for the entities that were actually called with save we could do that automatically.
        Hide
        nmervaillie Nicolas Mervaillie added a comment -

        In order to give users a better vision of what’s happening on SDN, we are bulk closing several issues because they are no more relevant, or related to old and un-maintained SDN versions.
        We tried to keep the issues that are still relevant, like feature requests that are still absent from SDN. However, some may have been closed by error. If so, please feel free to reopen.

        Show
        nmervaillie Nicolas Mervaillie added a comment - In order to give users a better vision of what’s happening on SDN, we are bulk closing several issues because they are no more relevant, or related to old and un-maintained SDN versions. We tried to keep the issues that are still relevant, like feature requests that are still absent from SDN. However, some may have been closed by error. If so, please feel free to reopen.

          People

          • Assignee:
            mhunger Michael Hunger
            Reporter:
            tims83 Timmy Storms
            Last updater:
            Nicolas Mervaillie
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: