logo

A basic JQL example

A basic JQL example

This project source code is available on github at https://github.com/deanhiller/playorm.

PlayOrm supports Scalable JQL. Below is an simple example(without partition) of a query using JQL.

On an entity Account which has two fields name (String) and isActive (boolean), we can define NoSqlQuery like this:

@NoSqlQuery(name="findAnd", query="select * FROM Account as a WHERE a.name=:name and a.isActive=:active")

 

Then, anywhere in our code we can use this query like below

Query<Account> query1 = mgr.createNamedQuery(Account.class, "findAnd");
query1.setParameter("name", "testname");
query1.setParameter("isActive ", true);
List<Account> accounts= query1.getResultList(0,null);

Click here to see an example of JQL using partition.

 

<< Back to Documentation Index