CassandraSessionFactoryBean session = new CassandraSessionFactoryBean(); session.setCluster(cluster().getObject()); session.setKeyspaceName(getKeyspaceName());
@Bean public CassandraSessionFactoryBean session() throws Exception { CassandraSessionFactoryBean session = new CassandraSessionFactoryBean(); session.setCluster(cluster().getObject()); session.setKeyspaceName(properties.getCassandra().getKeyspace()); session.setConverter(converter()); session.setSchemaAction(SchemaAction.NONE); return session; }
@Override @Bean public CassandraSessionFactoryBean session() throws Exception { CassandraSessionFactoryBean bean = new CassandraSessionFactoryBean(); bean.setCluster(cluster().getObject()); bean.setConverter(cassandraConverter()); bean.setSchemaAction(getSchemaAction()); bean.setKeyspaceName(getKeyspaceName()); return bean; } @Override public SchemaAction getSchemaAction() { return SchemaAction.RECREATE_DROP_UNUSED; } @Override public String[] getEntityBasePackages() { return new String[] {"com.example"}; //com.example package contains the bean with @table annotation }
public CassandraSessionFactoryBean session() throws Exception { CassandraSessionFactoryBean session = new CassandraSessionFactoryBean(); session.setCluster(cluster().getObject()); session.setKeyspaceName("mykeyspace");
/** * Creates a {@link CassandraSessionFactoryBean} that provides a Cassandra {@link com.datastax.driver.core.Session}. * The lifecycle of {@link CassandraSessionFactoryBean} initializes the {@link #getSchemaAction() schema} in the * {@link #getKeyspaceName() configured keyspace}. * * @return the {@link CassandraSessionFactoryBean}. * @see #cluster() * @see #cassandraConverter() * @see #getKeyspaceName() * @see #getSchemaAction() * @see #getStartupScripts() * @see #getShutdownScripts() */ @Bean public CassandraSessionFactoryBean session() { CassandraSessionFactoryBean session = new CassandraSessionFactoryBean(); session.setCluster(getRequiredCluster()); session.setConverter(cassandraConverter()); session.setKeyspaceName(getKeyspaceName()); session.setSchemaAction(getSchemaAction()); session.setStartupScripts(getStartupScripts()); session.setShutdownScripts(getShutdownScripts()); return session; }