Let's understand the Java APIs to use N1QL queries in our Java application. In order to demonstrate it, let's create another Maven project with the following details:
ModelVersion: 4.0.0 GroupId: com.ht ArtifactId: LearningCouchbaseN1QL
You need to ensure that the following dependency is included in your pom.xml
project:
<dependency> <groupId>com.couchbase.client</groupId> <artifactId>java-client</artifactId> <version>2.0.0</version> </dependency>
You also need to ensure that the version you use for this module is 2.0.0. At the time of writing this book, this is the only version compatible with the N1QL Developer Preview, which we have used in this book:
package com.ht.cql.view; import com.couchbase.client.java.Bucket; import com.couchbase.client.java.Cluster; import com.couchbase.client.java.CouchbaseCluster; import com.couchbase.client.java.query.QueryResult; import com.couchbase.client.java.query.QueryRow; /** * ...