0
votes

I have a following conditional update returning false. But when I check in the database the columns I was trying to update are in fact updated.

def deliver(d: Delivery, placedDate: java.time.LocalDate, locationKey: String, vendorId: String, orderId: String, code: String, courierId: String, courierName: String) = {
  update.
    where(_.placedDate eqs placedDate).
    and(_.locationKey eqs locationKey).
    and(_.vendorId eqs vendorId).
    and(_.orderId eqs orderId).
    modify(_.status setTo "DELIVERED").
    and(_.deliveredTime setTo LocalDateTime.now()).
    onlyIf(_.status is "COLLECTED").and(_.deliveryCode is code).future().map(_.wasApplied)
}

Thank you

1

1 Answers

0
votes

This is a pass through value for the phantom driver, which means that the Datastax Java Driver underneath is the one generating this. If you want to follow this up, could you please post a full bug on GitHub?

Meanwhile, I would suggest not relying on wasApplied if you are simply trying to test, and instead doing a direct read.

You generate some test data and the updated values, perform the update, and compare the final results in Cassandra by reading back. There are known problems with wasApplied with conditional batch updates, but aside from that I'm expecting this to work.