Skip to content

Regression prevent using update to remove an entry from a map [DATACASS-841] #1007

@spring-projects-issues

Description

@spring-projects-issues

Luc Boutier opened DATACASS-841 and commented

When migrating a project from 2.x to 3.x I encountered an issue on map field remove operation in a map.

@Table("contact")
class Contact(
    @PrimaryKeyColumn(name = "account_key", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
    var accountKey: UUID,
    @PrimaryKeyColumn(name = "id", ordinal = 1, type = PrimaryKeyType.PARTITIONED)
    var id: UUID,
    @Column("entity_details")
    var entityDetails: MutableMap<UUID, ContactEntityDetails> = mutableMapOf()
)

// Later in some update method:
val update = Update.RemoveOp(ColumnName.from("entityDetails"), entityId)
val query = Query.query(
    Criteria.where("accountKey").`is`(accountKey),
    Criteria.where("id").`is`(id)
)
return cassandraTemplate.update(query, update, Contact::class.java)

 

The update statement generated is the following:

UPDATE contact SET entity_details=entity_details-00000000-0000-4000-9000-000000000002 WHERE account_key=f9b520c9-c928-4360-ae69-90d4373cbd57 AND id=6dd405dc-cfbb-40ec-a626-ec18df63ab6d

There is curly braces missing as stated here 

 And this should be if I'm correct

UPDATE contact SET entity_details=entity_details-{00000000-0000-4000-9000-000000000002} WHERE account_key=f9b520c9-c928-4360-ae69-90d4373cbd57 AND id=6dd405dc-cfbb-40ec-a626-ec18df63ab6d

 

 


Affects: 3.1.2 (2020.0.2)

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions