0

How would I go about overriding AbstractCassandraConfiguration to use my own function to create a schema. I would like to be able to set up a Cassandra instance using a cql script that I select at runtime.

I have tried to override CassandraSessionFactoryBean.performSchemaAction() when it is created in AbstractCassandraConfiguration.session(). This causes cqllib to fail with

java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given

This seems to be related to how cqlib creates proxies: Superclass has no null constructors but no arguments were given

Community
  • 1
  • 1
trebon
  • 3
  • 3

1 Answers1

1

You can override getStartupScripts() in AbstractCassandraConfiguration. In there, you can do anything you want to. It's used by CassandraCqlClusterFactoryBean's executeSpecsAndScripts method (which is called in afterPropertiesSet).

Matthew Adams
  • 2,059
  • 2
  • 21
  • 31
  • Hmmm that might work. Would I be able to query my cluster inside of this method? – trebon Dec 02 '14 at 21:51
  • The method lets you execute arbitrary CQL scripts (as a `List`). Do whatever you'd like to in them. – Matthew Adams Dec 03 '14 at 15:29
  • This works with the slight caveat, that if I need need to any logic based on the current state of the cluster, I need to use the Datastax driver directly. – trebon Dec 03 '14 at 17:28