Last active
June 6, 2019 10:15
-
-
Save bhawna94/2f29a738dc054a298e730d04b6c7b55b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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