November 2018
Beginner to intermediate
260 pages
6h 12m
English
In the SqlQuery API, we cannot specify the SELECT query, but the SqlFieldsQuery allows us to write the SELECT query. The following SqlFieldsQuery selects the name field of SoccerPlayer:
System.out.println("Find name of each soccer player"); SqlFieldsQuery fieldQry = new SqlFieldsQuery("select name from SoccerPlayer");
When we query an IgniteCache with a SqlFieldQuery, it returns a FieldsQueryCursor with a list of selected rows, and each row contains the list of fields mentioned in the SELECT clause. The following code snippet fetches the names:
FieldsQueryCursor<List<?>> playerNamecursor = playerCache.query(fieldQry); playerNamecursor.forEach(name -> { System.out.println(name); });
Note that the playerNamecursor contains ...
Read now
Unlock full access