Spring-boot: Provide property to set CassandraSessionFactoryBean.schemaAction

Created on 5 Jan 2016  路  2Comments  路  Source: spring-projects/spring-boot

In CassandraDataAutoConfiguration, this property is hard-coded to SchemaAction.NONE.
Please add this property to CassandraProperties so it can be easily changed.

superseded

Most helpful comment

CassandraSessionFactoryBean requires an initial set of entities to perform schema actions. Spring Data Cassandra has _some_ support for it but it's an ugly solution. The initialEntitySet of BasicCassandraMappingContext is not set so SchemaAction would not create any tables at all. The initialization of BasicCassandraMappingContext would require an entity scan similar to MongoDataAutoConfiguration.

Flipping the option is only one part but the application has to provide also a @Bean for BasicCassandraMappingContext. Otherwise, setting SchemaAction has a very limited effect - the tables get removed with SchemaAction.RECREATE and SchemaAction.RECREATE_DROP_UNUSED but not (re) created.

All 2 comments

CassandraSessionFactoryBean requires an initial set of entities to perform schema actions. Spring Data Cassandra has _some_ support for it but it's an ugly solution. The initialEntitySet of BasicCassandraMappingContext is not set so SchemaAction would not create any tables at all. The initialization of BasicCassandraMappingContext would require an entity scan similar to MongoDataAutoConfiguration.

Flipping the option is only one part but the application has to provide also a @Bean for BasicCassandraMappingContext. Otherwise, setting SchemaAction has a very limited effect - the tables get removed with SchemaAction.RECREATE and SchemaAction.RECREATE_DROP_UNUSED but not (re) created.

Closing in favour of the PR #5855

Was this page helpful?
0 / 5 - 0 ratings