java - How create table with spring data cassandara? -


i have created own repository that:

public interface myrepository extends typedidcassandrarepository<myentity, string> { } 

so question how automatically create cassandra table that? spring injects myrepository tries insert entity non-existent table.

so there way create cassandra tables (if not exist) during spring container start up?

p.s. very nice if there config boolean property without adding lines of xml , creation beanfactory , etc. :-)

overide getschemaaction property on abstractcassandraconfiguration class

@configuration @enablecassandrarepositories(basepackages = "com.example") public class testconfig extends abstractcassandraconfiguration {      @override     public string getkeyspacename() {         return "test_config";     }      @override     public schemaaction getschemaaction() {         return schemaaction.recreate_drop_unused;     }      @bean     public cassandraoperations cassandraoperations() throws exception {         return new cassandratemplate(session().getobject());     }  } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -