DATACASS-135 - Fixed reference documentation build.
Removed empty lang attributes from programlisting elements. Switched to Docbook 4.4 DTD as 4.5 is currently not supported by the Maven Docbook plugin. Fixed section identifiers.
This commit is contained in:
@@ -4,49 +4,53 @@
|
||||
<chapter id="get-started">
|
||||
<title>Additional Help Resources</title>
|
||||
|
||||
<para>Learning a new framework is not always straight forward. In this section, we try to provide
|
||||
what we think is an easy to follow guide for starting with Spring Data Cassandra module.
|
||||
However, if you encounter issues or you are just looking for an advice, feel free to use one of
|
||||
the links below:</para>
|
||||
<para>Learning a new framework is not always straight forward. In this
|
||||
section, we try to provide what we think is an easy to follow guide for
|
||||
starting with Spring Data Cassandra module. However, if you encounter issues
|
||||
or you are just looking for an advice, feel free to use one of the links
|
||||
below:</para>
|
||||
|
||||
<section id="get-started:help">
|
||||
<section id="get-started.help">
|
||||
<title>Support</title>
|
||||
|
||||
<para>There are a few support options available:</para>
|
||||
|
||||
<section id="get-started:help:community">
|
||||
<section id="get-started.help.community">
|
||||
<title>Community Forum</title>
|
||||
|
||||
<para>The Spring Data <ulink url="http://forum.spring.io/forum/spring-projects/data">forum
|
||||
</ulink> is a message board for all Spring Data (not just Cassandra) users to share
|
||||
information and help each other. Note that registration is needed <emphasis>only</emphasis>
|
||||
for posting.</para>
|
||||
<para>The Spring Data <ulink
|
||||
url="http://forum.spring.io/forum/spring-projects/data">forum </ulink>
|
||||
is a message board for all Spring Data (not just Cassandra) users to
|
||||
share information and help each other. Note that registration is needed
|
||||
<emphasis>only</emphasis> for posting.</para>
|
||||
</section>
|
||||
|
||||
<section id="get-started:help:professional">
|
||||
<section id="get-started.help.professional">
|
||||
<title>Professional Support</title>
|
||||
|
||||
<para>Professional, from-the-source support, with guaranteed response time, is available from
|
||||
<ulink url="http://gopivotal.com/">Prowave Consulting</ulink>.</para>
|
||||
<para>Professional, from-the-source support, with guaranteed response
|
||||
time, is available from <ulink url="http://gopivotal.com/">Prowave
|
||||
Consulting</ulink>.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="get-started:up-to-date">
|
||||
<section id="get-started.up-to-date">
|
||||
<title>Following Development</title>
|
||||
|
||||
<para>For information on the Spring Data Cassandra source code repository, nightly builds and
|
||||
snapshot artifacts please see the <ulink
|
||||
url="http://projects.spring.io/spring-data-cassandra/">Spring Data Cassandra
|
||||
homepage</ulink>.</para>
|
||||
<para>For information on the Spring Data Cassandra source code repository,
|
||||
nightly builds and snapshot artifacts please see the <ulink
|
||||
url="http://projects.spring.io/spring-data-cassandra/">Spring Data
|
||||
Cassandra homepage</ulink>.</para>
|
||||
|
||||
<para>You can help make Spring Data best serve the needs of the Spring community by interacting
|
||||
with developers through the Spring Community <ulink url="http://forum.spring.io/"
|
||||
>forums</ulink>. To follow developer activity look for the mailing list information on the
|
||||
Spring Data Cassandra homepage.</para>
|
||||
<para>You can help make Spring Data best serve the needs of the Spring
|
||||
community by interacting with developers through the Spring Community
|
||||
<ulink url="http://forum.spring.io/">forums</ulink>. To follow developer
|
||||
activity look for the mailing list information on the Spring Data
|
||||
Cassandra homepage.</para>
|
||||
|
||||
<para>If you encounter a bug or want to suggest an improvement, please create a ticket on the
|
||||
Spring Data issue <ulink url="https://jira.springframework.org/browse/DATACASS"
|
||||
>tracker</ulink>.</para>
|
||||
<para>If you encounter a bug or want to suggest an improvement, please
|
||||
create a ticket on the Spring Data issue <ulink
|
||||
url="https://jira.springframework.org/browse/DATACASS">tracker</ulink>.</para>
|
||||
|
||||
<para>To stay up to date with the latest news and announcements in the
|
||||
Spring eco system, subscribe to the Spring Community <ulink
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<chapter id="cassandra.core">
|
||||
<title>Cassandra support</title>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<para>Then add the following to pom.xml dependencies section.</para>
|
||||
|
||||
<programlisting lang="" language="xml"><dependencies>
|
||||
<programlisting language="xml"><dependencies>
|
||||
|
||||
<!-- other dependency elements omitted -->
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
<para>Also change the version of Spring in the pom.xml to be</para>
|
||||
|
||||
<programlisting lang="" language="xml"><spring.framework.version>3.2.8.RELEASE</spring.framework.version></programlisting>
|
||||
<programlisting language="xml"><spring.framework.version>3.2.8.RELEASE</spring.framework.version></programlisting>
|
||||
|
||||
<para>You will also need to add the location of the Spring Milestone
|
||||
repository for maven to your pom.xml which is at the same level of your
|
||||
@@ -726,20 +726,27 @@ cassandraOperations.execute(cql);</programlisting>
|
||||
|
||||
<section id="cassandra-template-update">
|
||||
<title>Updating rows in a CQL table</title>
|
||||
<para>Much like inserting, there are several flavors of update from which you can
|
||||
choose.</para>
|
||||
|
||||
<para>Much like inserting, there are several flavors of update from
|
||||
which you can choose.</para>
|
||||
|
||||
<para>Update a record with an annotated POJO.</para>
|
||||
|
||||
<programlisting>cassandraOperations.update(new Person("123123123", "Alison", 35));</programlisting>
|
||||
<para>Update a row using the QueryBuilder.Update object that is part of the DataStax Java
|
||||
Driver.</para>
|
||||
|
||||
<para>Update a row using the QueryBuilder.Update object that is part of
|
||||
the DataStax Java Driver.</para>
|
||||
|
||||
<programlisting>Update update = QueryBuilder.update("person");
|
||||
update.setConsistencyLevel(ConsistencyLevel.ONE);
|
||||
update.with(QueryBuilder.set("age", 35));
|
||||
update.where(QueryBuilder.eq("id", "123123123"));
|
||||
|
||||
cassandraOperations.execute(update);</programlisting>
|
||||
<para>Then there is always the old fashioned way. You can write your own CQL
|
||||
statements.</para>
|
||||
|
||||
<para>Then there is always the old fashioned way. You can write your own
|
||||
CQL statements.</para>
|
||||
|
||||
<programlisting>String cql = "update person set age = 35 where id = '123123123'";
|
||||
|
||||
cassandraOperations.execute(cql);</programlisting>
|
||||
@@ -747,35 +754,50 @@ cassandraOperations.execute(cql);</programlisting>
|
||||
|
||||
<section id="cassandra-template.delete">
|
||||
<title>Methods for removing rows</title>
|
||||
<para>Much like inserting, there are several flavors of delete from which you can
|
||||
choose.</para>
|
||||
|
||||
<para>Much like inserting, there are several flavors of delete from
|
||||
which you can choose.</para>
|
||||
|
||||
<para>Delete a record with an annotated POJO.</para>
|
||||
|
||||
<programlisting>cassandraOperations.delete(new Person("123123123", null, 0));</programlisting>
|
||||
<para>Delete a row using the QueryBuilder.Delete object that is part of the DataStax Java
|
||||
Driver.</para>
|
||||
|
||||
<para>Delete a row using the QueryBuilder.Delete object that is part of
|
||||
the DataStax Java Driver.</para>
|
||||
|
||||
<programlisting>Delete delete = QueryBuilder.delete().from("person");
|
||||
delete.where(QueryBuilder.eq("id", "123123123"));
|
||||
|
||||
cassandraOperations.execute(delete);</programlisting>
|
||||
<para>Then there is always the old fashioned way. You can write your own CQL
|
||||
statements.</para>
|
||||
|
||||
<para>Then there is always the old fashioned way. You can write your own
|
||||
CQL statements.</para>
|
||||
|
||||
<programlisting>String cql = "delete from person where id = '123123123'";
|
||||
|
||||
cassandraOperations.execute(cql);</programlisting>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Methods for truncating tables</title>
|
||||
<para>Much like inserting, there are several flavors of truncate from which you can
|
||||
choose.</para>
|
||||
|
||||
<para>Much like inserting, there are several flavors of truncate from
|
||||
which you can choose.</para>
|
||||
|
||||
<para>Truncate a table using the truncate() method.</para>
|
||||
|
||||
<programlisting>cassandraOperations.truncate("person");</programlisting>
|
||||
<para>Truncate a table using the QueryBuilder.Truncate object that is part of the DataStax
|
||||
Java Driver.</para>
|
||||
|
||||
<para>Truncate a table using the QueryBuilder.Truncate object that is
|
||||
part of the DataStax Java Driver.</para>
|
||||
|
||||
<programlisting>Truncate truncate = QueryBuilder.truncate("person");
|
||||
|
||||
cassandraOperations.execute(truncate);</programlisting>
|
||||
<para>Then there is always the old fashioned way. You can write your own CQL
|
||||
statements.</para>
|
||||
|
||||
<para>Then there is always the old fashioned way. You can write your own
|
||||
CQL statements.</para>
|
||||
|
||||
<programlisting>String cql = "truncate person";
|
||||
|
||||
cassandraOperations.execute(cql);</programlisting>
|
||||
@@ -784,32 +806,43 @@ cassandraOperations.execute(cql);</programlisting>
|
||||
|
||||
<section id="cassandra.query">
|
||||
<title>Querying CQL Tables</title>
|
||||
<para>Tthere are several flavors of select and query from which you can choose. Please see the
|
||||
CassandraTemplate API documentation for all overloads available.</para>
|
||||
<para>Query a table for multiple rows and map the results to a POJO.</para>
|
||||
|
||||
<para>Tthere are several flavors of select and query from which you can
|
||||
choose. Please see the CassandraTemplate API documentation for all
|
||||
overloads available.</para>
|
||||
|
||||
<para>Query a table for multiple rows and map the results to a
|
||||
POJO.</para>
|
||||
|
||||
<programlisting>String cqlAll = "select * from person";
|
||||
|
||||
List<Person> results = cassandraOperations.select(cqlAll, Person.class);
|
||||
List<Person> results = cassandraOperations.select(cqlAll, Person.class);
|
||||
for (Person p : results) {
|
||||
LOG.info(String.format("Found People with Name [%s] for id [%s]", p.getName(), p.getId()));
|
||||
}</programlisting>
|
||||
|
||||
<para>Query a table for a single row and map the result to a POJO.</para>
|
||||
|
||||
<programlisting>String cqlOne = "select * from person where id = '123123123'";
|
||||
|
||||
Person p = cassandraOperations.selectOne(cqlOne, Person.class);
|
||||
LOG.info(String.format("Found Person with Name [%s] for id [%s]", p.getName(), p.getId()));</programlisting>
|
||||
<para>Query a table using the QueryBuilder.Select object that is part of the DataStax Java
|
||||
Driver.</para>
|
||||
|
||||
<para>Query a table using the QueryBuilder.Select object that is part of
|
||||
the DataStax Java Driver.</para>
|
||||
|
||||
<programlisting>Select select = QueryBuilder.select().from("person");
|
||||
select.where(QueryBuilder.eq("id", "123123123"));
|
||||
|
||||
Person p = cassandraOperations.selectOne(select, Person.class);
|
||||
LOG.info(String.format("Found Person with Name [%s] for id [%s]", p.getName(), p.getId()));</programlisting>
|
||||
<para>Then there is always the old fashioned way. You can write your own CQL statements, and
|
||||
there are several callback handlers for mapping the results. The example uses the RowMapper
|
||||
interface.</para>
|
||||
|
||||
<para>Then there is always the old fashioned way. You can write your own
|
||||
CQL statements, and there are several callback handlers for mapping the
|
||||
results. The example uses the RowMapper interface.</para>
|
||||
|
||||
<programlisting>String cqlAll = "select * from person";
|
||||
List<Person> results = cassandraOperations.query(cqlAll, new RowMapper<Person>() {
|
||||
List<Person> results = cassandraOperations.query(cqlAll, new RowMapper<Person>() {
|
||||
|
||||
public Person mapRow(Row row, int rowNum) throws DriverException {
|
||||
Person p = new Person(row.getString("id"), row.getString("name"), row.getInt("age"));
|
||||
@@ -877,23 +910,25 @@ for (Person p : results) {
|
||||
<section id="cassandra-template.commands.execution">
|
||||
<title>Methods for executing commands</title>
|
||||
|
||||
<para>The CassandraTemplate has many overloads for execute() and executeAsync(). Pass in the
|
||||
CQL command you wish to be executed, and handle the appropriate response.</para>
|
||||
<para>This example uses the basic AsynchronousQueryListener that comes with Spring Data
|
||||
Cassandra. Please see the API documentation for all the options. There should be nothing
|
||||
you cannot perform in Cassandra with the execute() and executeAsync() methods.</para>
|
||||
<para>
|
||||
<programlisting>cassandraOperations.executeAsynchronously("delete from person where id = '123123123'",
|
||||
<para>The CassandraTemplate has many overloads for execute() and
|
||||
executeAsync(). Pass in the CQL command you wish to be executed, and
|
||||
handle the appropriate response.</para>
|
||||
|
||||
<para>This example uses the basic AsynchronousQueryListener that comes
|
||||
with Spring Data Cassandra. Please see the API documentation for all the
|
||||
options. There should be nothing you cannot perform in Cassandra with
|
||||
the execute() and executeAsync() methods.</para>
|
||||
|
||||
<para><programlisting>cassandraOperations.executeAsynchronously("delete from person where id = '123123123'",
|
||||
new AsynchronousQueryListener() {
|
||||
|
||||
public void onQueryComplete(ResultSetFuture rsf) {
|
||||
LOG.info("Async Query Completed");
|
||||
}
|
||||
});</programlisting>
|
||||
</para>
|
||||
<para>This example shows how to create and drop a table, using different API objects, all
|
||||
passed to the execute()
|
||||
methods.<programlisting>cassandraOperations.execute("create table test_table (id uuid primary key, event text)");
|
||||
});</programlisting></para>
|
||||
|
||||
<para>This example shows how to create and drop a table, using different
|
||||
API objects, all passed to the execute() methods.<programlisting>cassandraOperations.execute("create table test_table (id uuid primary key, event text)");
|
||||
|
||||
DropTableSpecification dropper = DropTableSpecification.dropTable("test_table");
|
||||
cassandraOperations.execute(dropper);</programlisting></para>
|
||||
|
||||
Reference in New Issue
Block a user