Also note, here is an example...

https://github.com/spring-projects/spring-gemfire-examples/tree/master/quickstart/json

On Sat, Dec 31, 2016 at 3:22 PM, John Blum <[email protected]> wrote:

> Dharam-
>
> You should take a look at this...
>
> http://docs.spring.io/spring-data-gemfire/docs/current/
> reference/html/#bootstrap:region:json
>
> Also, be aware that if you stick a (JSON) "String" in a Region as a value
> (i.e. Region.put(key, stringValue)) then the type of the value will be a
> String, not a PDX instance as I assume you would expect.  Geode has no idea
> whether you are sticking JSON into a Region or a String.
>
> Additionally, using JSONFormatter is clunky and limiting since you are
> now tied to the JSON processing implementation of JSONFormatter.
> Likewise, it only knows about JSON Strings (PdxInstance:fromJSON(:String))
> and PDX Instances (toJSON(:PdxInstance)).  What happens if you pass in an
> Object? What then?
>
> Under-the-hood, the SDG Region auto-proxy support uses JSONFormatter, but
> also knows what to do with a POJO if a Region.put(key, Object) occurs
> since that Region is proxied to store JSON, err... PDX content.
>
> You must have the JSON data stored in Geode as a PdxInstance to be able to
> index and query the JSON document.
>
> Hope this helps!
>
> -John
>
>
>
>
> On Sat, Dec 31, 2016 at 8:59 AM, Dharam Thacker <[email protected]
> > wrote:
>
>> Hi Team,
>>
>> Wish you all a very happy new year!
>>
>> Is there any example on json processing with apache geode?
>>
>> Could you help us with below examples on how region definition would look
>> like?
>>
>> *Example*:
>>
>> *Case1: Primary key <java.lang.String>*
>>
>> region.put(String.valueOf(i), JSONFormatter.fromJSON(obj.toJSONString()));
>>
>> For above, I believe it should be --> Region<String,PdxInstance> then how
>> does it look like in spring data geode xml configuration?
>>
>>
>> *Case2: Primary Key <? extends java.lang.Serializable>*
>>
>> region.put (new CustomObject() , JSONFormatter.fromJSON(obj.toJ
>> SONString()));
>>
>> For above, I believe it should be --> Region<CustomObject,PdxInstance>
>> then how does it look like in spring data geode xml configuration?
>>
>> *Case3: Is below case valid one and recommended ?*
>>
>> @Region
>> Class JSONRegion {
>>      CustomPrimaryKeyObject primaryKey;
>>      JSONObject jsonObject;
>>
>>      // Constructor + Getter/Setter
>> }
>>
>>
>> More is there any limitation/pros-cons if we store JSON document as value
>> vs schema bound domain java object?
>>
>> Thanks & Regards,
>> - Dharam Thacker
>>
>
>
>
> --
> -John
> john.blum10101 (skype)
>



-- 
-John
john.blum10101 (skype)

Reply via email to