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
Post a Comment