Uploaded image for project: 'Spring Data for Apache Cassandra'
  1. Spring Data for Apache Cassandra
  2. DATACASS-618

Add support for entity updates before save using EntityCallbacks

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.2 RC1 (Moore)
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true
    • Sprint:
      Moore RC1

      Description

      I have a CassandraEventListener extends AbstractCassandraEventListener whitch modifies the entity in the onBeforeSave method.

      While the entity is modified, the modification is not saved in Cassandra. During debug, it was found because of the following:

       

      • In CassandraTemplate.java

      Insert insert = QueryUtils.createInsertQuery(tableName.toCql(), entity, options, this.getConverter(), persistentEntity);

      this.maybeEmitEvent(new BeforeSaveEvent(entity, tableName, insert));

       

      The CQL Insert statement creates the statement first with existing entity and THEN executes the onBeforeSave. However, the rest of the flow will use the insert statement that was already created thus not being able to use the new version of the entity.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mp911de Mark Paluch
              Reporter:
              rami.deltoro Rami Del Toro
              Last updater:
              Mark Paluch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 37 weeks, 6 days ago