@Override
protected String getKeyspaceName() {
return KEYSPACE;
}
@Bean
public CassandraOperations CassandraTemplate() {
return new CassandraOperations(session().getObject());
}
I am able to connect to my
keyspace present on the remote node i am trying to connect to. I can see it from the logs in my app. Then i tried accessing the bean created in my DAO layer to query the Database by doing autowiring. As it is given in the readme of Spring data Cassandra example. I used something similar to the below code in my app.
@Autowired
private CassandraOperations CassandraTemplate;
public Integer getCount() throws DataAccessException {
String cql = "select count(*) from table_name where id='12345'";
Integer count = CassandraTemplate.queryForObject(cql, Integer.class);
log.info("Row Count is -> " + count);
return count;
}
Autowiring is happening but the bean i am trying to access is coming null. Is there anything i am missing in implementing this? please provide your inputs.