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.