Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public List<Employee> getEmployeeUsingCustomQuery(String name) {
//creating query on the basis of empName
String statement = "select empName, empId, META().id AS _ID, META().cas AS _CAS from Bucket1 where empName=$empName";
JsonObject placeHolder = JsonObject.create().put("empName", name);
N1qlQuery n1qlQuery = N1qlQuery.parameterized(statement, placeHolder);
//findbyN1QL method query the N!QL service and mapped to the Employee class.
return couchbaseTemplate.findByN1QL(n1qlQuery, Employee.class);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment