Spring Data Neo4j
  1. Spring Data Neo4j
  2. DATAGRAPH-335

No ApplicationEvent in advanced mapping mode

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Trivial Trivial
    • Resolution: Unresolved
    • 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
        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
        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
        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
        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.

          People

          • Assignee:
            Michael Hunger
            Reporter:
            Timmy Storms
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: