'How to use same query by changing column names for multiple methods in Cassandra Repository - CQL using @Query?
I want to be able to use the same query just by changing the name of the column in an interface that extends CassandraRepository. For eg.
public interface TestRepository extends CassandraRepository<TestTable, String> {
@Query("update column_one set col_val= :col_val where id= :custId ")
void saveData1(@Param("custId") String custId, @Param("col_val") String col_val);
@Query("update column_two set col_val= :col_val where id= :custId ")
void saveData2(@Param("custId") String custId, @Param("col_val") String col_val);
}
Here I am using the same query with just a colum name change. Is there an option that I can give a custom column name or any other solution so that one single query and method can be used? Any help is appreciated. Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|