Having a problem with the 4.5 Datastax Cassandra driver. I cannot get any of these @Queries to work:
@Dao
public interface SampleTable2Dao extends BaseDao<SampleTable2> {
//@Query("UPDATE sampletable2 SET cntrfld = cntrfld + :toAdd WHERE key1 = :key1Value AND key2 = :key2Value AND key3 = :key3Value")
@Query("UPDATE sampletable2 SET cntrfld = cntrfld + 1 WHERE key1 = 1 AND key2 = 1 AND key3 = 1;")
CompletableFuture<Void> addCountAsync(int toAdd, int key1Value, int key2Value, int key3Value);
@Query("UPDATE sampletable2 SET cntrfld = cntrfld + 1 WHERE key1 = 1 AND key2 = 1 AND key3 = 1;")
void addCount(int toAdd, int key1Value, int key2Value, int key3Value);
@Query("UPDATE sampletable2 SET cntrfld = cntrfld + 1 WHERE key1 = 1 AND key2 = 1 AND key3 = 1;")
void addCount();
It simply hangs:
getSampleTable2Dao().addCount();
The queries work fine directly in Cassandra.
Thanks
P.S. here is the table for anyone wants to test:
CREATE TABLE sampletable2 (
key1 int,
key2 int,
key3 int,
cntrfld counter,
PRIMARY KEY (key1, key2, key3)
);
update #1
After some digging, I find that it's in this generated code where it's hanging. Nothing to do with the actual query:
this.sampleTable2DaoCache = new LazyReference<>(() -> SampleTable2DaoImpl__MapperGenerated.init(context));
@Override
public SampleTable2Dao sampleTable2Dao() {
return sampleTable2DaoCache.get();
}
I'm working my way backwards stripping things out until I can get it working. Other DAOs work fine - the only difference with this is the counter field.
UPDATE #2... the "real" issue, is not @Query at all... but @Entity with counter fields.
@CqlName("cntrfld")
private Long cntrFld;
If this field is a counter in Cassandra (3.11.4 btw) the code just hangs. If I make the field a bigint, it works just fine!