Search in sources :

Example 6 with Statement

use of com.couchbase.client.java.query.Statement in project jnosql-diana-driver by eclipse.

the class CouchbaseDocumentCollectionManagerTest method shouldRunN1QlStatementParams.

@Test
public void shouldRunN1QlStatementParams() {
    DocumentEntity entity = getEntity();
    entityManager.insert(entity);
    Statement statement = Select.select("*").from("jnosql").where(x("name").eq("$name"));
    JsonObject params = JsonObject.create().put("name", "Poliana");
    List<DocumentEntity> entities = entityManager.n1qlQuery(statement, params);
    assertFalse(entities.isEmpty());
    assertEquals(1, entities.size());
}
Also used : DocumentEntity(org.jnosql.diana.api.document.DocumentEntity) Statement(com.couchbase.client.java.query.Statement) JsonObject(com.couchbase.client.java.document.json.JsonObject) Test(org.junit.jupiter.api.Test)

Example 7 with Statement

use of com.couchbase.client.java.query.Statement in project jnosql-diana-driver by eclipse.

the class CouchbaseDocumentCollectionManagerTest method shouldRunN1QlStatement.

@Test
public void shouldRunN1QlStatement() {
    DocumentEntity entity = getEntity();
    entityManager.insert(entity);
    Statement statement = Select.select("*").from("jnosql").where(x("name").eq("\"Poliana\""));
    List<DocumentEntity> entities = entityManager.n1qlQuery(statement);
    assertFalse(entities.isEmpty());
    assertEquals(1, entities.size());
}
Also used : DocumentEntity(org.jnosql.diana.api.document.DocumentEntity) Statement(com.couchbase.client.java.query.Statement) Test(org.junit.jupiter.api.Test)

Aggregations

Statement (com.couchbase.client.java.query.Statement)7 JsonObject (com.couchbase.client.java.document.json.JsonObject)3 N1qlQueryResult (com.couchbase.client.java.query.N1qlQueryResult)3 DocumentEntity (org.jnosql.diana.api.document.DocumentEntity)3 Test (org.junit.jupiter.api.Test)3 Bucket (com.couchbase.client.java.Bucket)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 Test (org.junit.Test)2 SimpleN1qlQuery (com.couchbase.client.java.query.SimpleN1qlQuery)1 Expression (com.couchbase.client.java.query.dsl.Expression)1 GeneralSecurityException (java.security.GeneralSecurityException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Sort (org.jnosql.diana.api.Sort)1