anchor.diff:  }
   ----
   
  +The translation to and from JSON is done automatically by the Quarkus RestEasy extension, which is
  +included in this guide's pom.xml file. If you want to add it manually to your application, add the
  +below snippet to your application's ppm.xml file:
  +
  +[source,xml]
  +----
  +<dependency>
  +  <groupId>io.quarkus</groupId>
  +  <artifactId>quarkus-resteasy</artifactId>
  +</dependency>
  +<dependency>
  +  <groupId>io.quarkus</groupId>
  +  <artifactId>quarkus-resteasy-jsonb</artifactId>
  +</dependency>
  +----
  +
   IMPORTANT: DTO classes used by the JSON serialization layer are required to have a default no-arg
   constructor.
   
  -== Configuring the Cassandra database
  +The conversion from DTO to JSON is handled automatically for us, but we still must convert from
  +`Fruit` to `FruitDto` and vice versa. This must be done manually, which is why we have two
  +conversion methods declared in `FruitResource`: `convertToDto` and `convertFromDto`.
  +
  +TIP: In our example, `Fruit` and `FruitDto` are very similar, so you might wonder why not use
  +`Fruit` everywhere. In real life cases though, it's not uncommon to see DTOs and entities having
  +very different structures.
  +
  +== Connecting to the Cassandra Database
   
   === Connecting to Apache Cassandra or DataStax Enterprise (DSE)
   
  -The main properties to configure are: `contact-points`, to access the Cassandra database,
  -`local-datacenter`, which is required by the driver, and – optionally – the keyspace to bind to.
  +The main properties to configure are: `contact-points`, to access the Cassandra database;
  +`local-datacenter`, which is required by the driver; and – optionally – the keyspace to bind to.
   
   A sample configuration should look like this:
   
  
positive.code: }
  ----
  
  The mapper is responsible for constructing instances of `FruitDao`. In the example above, the
  `FruitDao` instance will be connected to the same keyspace as the underlying session. More on that
  below.
  
  TIP: It is also possible to create DAO instances for different keyspaces. To learn how, see
  link:https://docs.datastax.com/en/developer/java-driver/4.7/manual/mapper/mapper/#dao-parameterization[DAO parameterization]
  in the driver docs.
  
  Next, we need a component to create our DAO instances: `FruitDaoProducer`. Indeed, Mapper and Dao
  instances are stateful objects, and should be created only once, as application-scoped singletons.
  This component will do exactly that, leveraging Quarkus Dependency Injection container:
  
  [source, java]
  ----
  import com.datastax.oss.driver.api.core.CqlIdentifier;
  import com.datastax.oss.quarkus.runtime.api.config.CassandraClientConfig;
  import com.datastax.oss.quarkus.runtime.api.session.QuarkusCqlSession;
  import javax.enterprise.context.ApplicationScoped;
  import javax.enterprise.inject.Produces;
  import javax.inject.Inject;
  
  public class FruitDaoProducer {
  
    private final FruitDao fruitDao;
    private final FruitDaoReactive fruitDaoReactive;
  
    @Inject
    public FruitDaoProducer(QuarkusCqlSession session) {
      // create a mapper
      FruitMapper mapper = new FruitMapperBuilder(session).build();
      // instantiate our Daos
      fruitDao = mapper.fruitDao();
      fruitDaoReactive = mapper.fruitDaoReactive();
    }
  
    @Produces
    @ApplicationScoped
    FruitDao produceFruitDao() {
      return fruitDao;
    }
  
    @Produces
    @ApplicationScoped
    FruitDaoReactive produceFruitDaoReactive() {
      return fruitDaoReactive;
    }
  }
  ----
  
  Note how the `QuarkusCqlSession` instance is injected automatically by the cassandra-quarkus
  extension in the `FruitDaoProducer` constructor.
  
  Also note that `FruitMapperBuilder` is one of the classes generated automatically by the
  `java-driver-mapper-processor` annotation processor.
  
  Now create a `FruitService` that will be the business layer of our application and store/load the
  fruits from the Cassandra database.
  
  [source,java]
  ----
  @ApplicationScoped
  public class FruitService {
  
    private final FruitDao dao;
  
    @Inject
    public FruitService(FruitDao dao) {
      this.dao = dao;
    }
  
    public void save(Fruit fruit) {
      dao.update(fruit);
    }
  
    public List<Fruit> get(String id) {
      return dao.findById(id).all();
    }
  }
  ----
  
  Note how the service receives a `FruitDao` instance in the constructor. This DAO instance is
  provided by `FruitDaoProducer` and injected automatically.
  
  The last missing piece is the REST API that will expose GET and POST methods:
  
  [source,java]
  ----
  @Path("/fruits")
  public class FruitResource {
  
    private static final String STORE_NAME = "acme";
  
    @Inject FruitService fruitService;
  
    @GET
    public List<FruitDto> list() {
      return fruitService.get(STORE_NAME).stream()
          .map(fruit -> new FruitDto(fruit.getName(), fruit.getDescription()))
          .collect(Collectors.toList());
    }
  
    @POST
    public void add(FruitDto fruit) {
      fruitService.save(covertFromDto(fruit));
    }
  
    private Fruit covertFromDto(FruitDto fruitDto) {
      return new Fruit(fruitDto.getName(), fruitDto.getDescription(), STORE_NAME);
    }
  }
  ----
  
  The `list` and `add` operations are executed for the `storeId` "acme". This is the partition key of
  our data model. We can easily retrieve all rows from cassandra using that partition key.
  They will be sorted by the clustering column. `FruitResource` is using `FruitService` which
  encapsulates the data access logic.
  
  When creating the REST API we should not share the same entity object between REST API and data
  access layers. They should not be coupled to allow the API to evolve independently of the storage
  layer. This is the reason why the API is using a `FruitDto` class. This class will be used by
  Quarkus to convert JSON to java objects for client requests and java objects to JSON for the
  responses. The translation is done by quarkus-resteasy extension.
  
  [source,java]
  ----
  
negative.code: 
  == Prerequisites
  
  To complete this quickstart guide, you need:
  
  * an IDE;
  * JDK 1.8+ installed with `JAVA_HOME` configured appropriately;
  * link:https://www.graalvm.org/[GraalVM] installed with the `GRAALVM_HOME` environment variable
  configured appropriately, if you want to
  link:https://quarkus.io/guides/building-native-image[use the native mode];
  * Apache Maven 3.5.3+;
  * A running link:https://cassandra.apache.org[Apache Cassandra],
  link:https://www.datastax.fr/products/datastax-enterprise[DataStax Enterprise] (DSE) or
  link:https://astra.datastax.com[DataStax Astra] database; or alternatively, a fresh Docker
  installation.
  
  == Architecture
  
  This quickstart guide shows how to build a REST application using the
  link:https://github.com/datastax/cassandra-quarkus[Cassandra Quarkus extension], which allows you to
  connect to an Apache Cassandra, DataStax Enterprise (DSE) or DataStax Astra database, using the
  link:https://docs.datastax.com/en/developer/java-driver/latest[DataStax Java driver].
  
  This guide will also use the
  link:https://docs.datastax.com/en/developer/java-driver/latest/manual/mapper[DataStax Object Mapper]
  – a powerful Java-to-CQL mapping framework that greatly simplifies your application's data access
  layer code by sparing you the hassle of writing your CQL queries by hand.
  
  The application built in this quickstart guide is quite simple: the user can add elements in a list
  using a form, and the items list is updated. All the information between the browser and the server
  is formatted as JSON, and the elements are stored in the Cassandra database.
  
  == Solution
  
  We recommend that you follow the instructions in the next sections and create the application step
  by step. However, you can go right to the completed example.
  
  The solution is located in the
  link:https://github.com/datastax/cassandra-quarkus/tree/master/quickstart[quickstart directory] of
  the Cassandra Quarkus extension GitHub repository.
  
  == Creating a Blank Maven Project
  
  First, create a new Maven project and copy the `pom.xml` file that is present in the `quickstart`
  directory.
  
  The `pom.xml` is importing all the Quarkus extensions and dependencies you need.
  
  == Creating the Data Model and Data Access Objects
  
  In this example, we will create an application to manage a list of fruits.
  
  First, let's create our data model – represented by the `Fruit` class – as follows:
  
  [source,java]
  ----
  @Entity
  @PropertyStrategy(mutable = false)
  public class Fruit {
  
      @PartitionKey
      private final String name;
  
      private final String description;
  
      public Fruit(String name, String description) {
        this.name = name;
        this.description = description;
      }
    // getters, hashCode, equals, toString methods omitted for brevity
  }
  ----
  
  As stated above, we are using the DataStax Object Mapper. In other words, we are not going to write
  our CQL queries manually; instead, we will annotate our data model with a few annotations, and the
  mapper will generate proper CQL queries underneath.
  
  This is why the `Fruit` class is annotated with `@Entity`: this annotation marks it as an _entity
  class_ that is mapped to a Cassandra table. Its instances are meant to be automatically persisted
  into, and retrieved from, the Cassandra database. Here, the table name will be inferred from the
  class name: `fruit`.
  
  Also, the `name` field represents a Cassandra partition key, and so we are annotating it with
  `@PartitionKey` – another annotation from the Object Mapper library.
  
  IMPORTANT: Entity classes are normally required to have a default no-arg constructor, unless they
  are annotated with `@PropertyStrategy(mutable = false)`, which is the case here.
  
  The next step is to create a DAO (Data Access Object) interface that will manage instances of
  `Fruit` entities:
  
  [source,java]
  ----
  