I'm building a Springboot Backend using Cassandra as a database stored in Azure. I'm facing a weird issue which happens randomly, and usually at the first start of the application.
My data model :
@Table("product_user_habit")
public class ProductUserHabitDTO {
@Column
@PrimaryKey
private ProductUserKey puk;
@Column
private String product_name;
@Column
private String category;
@Column
private int quantity;
@Column
private String brand;
public ProductUserHabitDTO() {
}
public ProductUserHabitDTO(ProductUserKey puk,
String product_name,
String category, String brand, int quantity) {
this.puk = puk;
this.product_name = product_name;
this.category = category;
this.quantity = quantity;
this.brand = brand;
}
My Repository :
@Repository
public interface ProductUserHabitsRepository extends CassandraRepository<ProductUserHabitDTO, ProductUserKey> {
@AllowFiltering
ProductUserHabitDTO findProductUserHabitDTOByPuk_UseridAndPuk_Code(String username, String code);
}
When I call this method, it throws this (usually at first starts) :
"Query; CQL [SELECT * FROM product_user_habit WHERE userid='bbbbbbbb' AND code='3274080005003' ALLOW FILTERING;]; Expected size of integer 8: Got 13 bytes; nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Expected size of integer 8: Got 13 bytes","trace":"org.springframework.data.cassandra.CassandraInvalidQueryException: Query; CQL [SELECT * FROM product_user_habit WHERE userid='bbbbbbbb' AND code='3274080005003' ALLOW FILTERING;]; Expected size of integer 8: Got 13 bytes;"
And sometimes it works fine. I don't understand because I don't have any integer in my query. Also for my tests I always use the same query so the userid and code work.
Do someone has a clue of what is happening ? It's driving me crazy :(
Thanks !