Hi Team,

I have a JsonRegion which looks like Region<String,PdxInstance>.

Example : jsonRegionTemplate.put("1", JSONFormatter.fromJSON(s));

There is a simple requirement where my query say, "Give me all books whose
category is fiction"

DBMS : select * from Book where catrgory = 'fiction' [Simple as there is
only 1 store]

DBMS : select b.* from Store s,Book b where s.id = b.storeId and b.category
= 'fiction' [If there are multiple stores -- But simple and clean]

OQL : select j.store.book from /jsonRegion j where j.store.book[0].category
= 'fiction'

*Above OQL is not all worth I guess as you can never know index :)
[Trivial]. *



*Is there any way to extract the same?*

*Probably : select j from /jsonRegion j where j.store.book[*].category =
'fiction'*

Contents as below, which I extracted using below,

System.out.println("In region [" + regionName + "] created key [" + key+ "]
--> value [" + JSONFormatter.toJSON((PdxInstance) newValue) + "]");

key [1] --> value [{
  "store" : {
    "book" : [ {
      "category" : "reference",
      "author" : "Nigel Rees",
      "title" : "Sayings of the Century",
      "price" : 8.95
    }, {
      "category" : "fiction",
      "author" : "Evelyn Waugh",
      "title" : "Sword of Honour",
      "price" : 12.99
    }, {
      "category" : "fiction",
      "author" : "Herman Melville",
      "title" : "Moby Dick",
      "isbn" : "0-553-21311-3",
      "price" : 8.99
    }, {
      "category" : "fiction",
      "author" : "J. R. R. Tolkien",
      "title" : "The Lord of the Rings",
      "isbn" : "0-395-19395-8",
      "price" : 22.99
    } ],
    "bicycle" : {
      "color" : "red",
      "price" : 19.95
    }
  }
}]

Thanks,
- Dharam Thacker

Reply via email to