John, Michael,

Thanks for the info.

Michael can you please let me know what you mean by this :- "don't need to
push you domain objects into the servers in order to query or index them"

Regards


On Sat, Jul 1, 2017 at 12:26 AM, Michael Stolz <[email protected]> wrote:

> Actually, the system will automatically "punt" to Java serialization if
> there is no PDX serializer for a given class and the class is Serializable.
>
> The big trouble with that is it can hide errors in your PDX configuration,
> silently resorting to Java Serializable when you are thinking that you are
> getting PDX serialization.
>
> Therefore, I actually recommend that you do not make your domain objects
> Serializable if you are using PDX.
>
> The additional niceties that you get from PDX serialization are that you
> don't need to push you domain objects into the servers in order to query or
> index them, you can relatively easily translate cached domain objects to
> C++ or C#, and you can actually manipulate data via functions inside the
> cache without having to deserialize the whole object.
>
>
>
> --
> Mike Stolz
> Principal Engineer, GemFire Product Manager
> Mobile: +1-631-835-4771
>
> On Fri, Jun 30, 2017 at 12:49 PM, John Blum <[email protected]> wrote:
>
>> Hi Amit-
>>
>> Regarding...
>>
>> *> Can we combine the two serialization Java and PDX? *
>>
>> I was tempted to say NO until I thought well, what would happen if some
>> of my application domain objects implemented java.io.Serializable while
>> others implemented org.apache.geode.pdx.PdxSerializable or
>> org.apache.geode.DataSerializable.
>>
>> I am not sure actually; I have never tried this.  I would not recommend
>> it... i.e. I would stick to 1 serialization strategy.  You could have
>> adverse affects if read-serialized was set to true, or you were running
>> OQL queries on a Region that stored a mix of serialized objects (e.g. PDX +
>> Java Serialized), etc.
>>
>> Remember (as I stated earlier)...
>>
>> "*If either DataSerialization or PDX Serialization is configured, even
>> if your application domain object implements java.io
>> <http://java.io>.Serializable, then Geode will prefer its own serialization
>> mechanics over Java Serialization**.*"
>>
>>
>> Finally, as for...
>>
>> *> By the way somehow in my case PDX is used although I never supplied
>> any PDX ReflectionBasedAutoSerializer.  Can you let me know the possible
>> reasons for it?*
>>
>> The only way PDX will be used is if you...
>>
>>
>> 1. Set the pdx-serializer-ref attribute on the <gfe:cache> element in
>> the SDG XML namespace to any PdxSerializer implementation, for example...
>>
>> <bean *id=**"mySerializer"* class="org.example.app.geode.s
>> erialization.MyPdxSerializer"/>
>>
>> <gfe:cache properties-ref="gemfireProperties" *pdx-serializer-ref=*
>> *"mySerializer"* pdx-read-serialized="true"
>>            pdx-persistent="true" pdx-disk-store="pdxStore"/>
>>
>> Or, if you set the pdxSerializer property
>> <http://docs.spring.io/spring-data-gemfire/docs/current/api/org/springframework/data/gemfire/CacheFactoryBean.html#setPdxSerializer-java.lang.Object->
>>  [1]
>> on the [Client]CacheFactoryBean.  It also does NOT matter if
>> ReflectionBasedAutoSerializer is used or not.  In fact, I would not
>> recommend using ReflectionBasedAutoSerializer.  I would rather use SDG's
>> MappingPdxSerializer or custom, dedicated PdxSerializers.
>>
>>
>> 2. Or, your application domain object implements
>> org.apache.geode.pdx.PdxSerializable.
>>
>>
>> if either of these 2 things are true, then PDX is used.
>>
>> Regards,
>> John
>>
>>
>> [1] http://docs.spring.io/spring-data-gemfire/docs/current/
>> api/org/springframework/data/gemfire/CacheFactoryBean.html#
>> setPdxSerializer-java.lang.Object-
>>
>>
>> On Thu, Jun 29, 2017 at 10:50 PM, Amit Pandey <[email protected]>
>> wrote:
>>
>>> Hey John,
>>>
>>> Can we combine the two serialization Java and PDX? I want to use Java
>>> for some domain objects which have circular dependencies until we figure
>>> out a better way to represent them and use PDX for others?
>>>
>>> By the way somehow in my case PDX is used although I never supplied any
>>> PDX ReflectionBasedAutoSerializer.
>>>
>>> Can you let me know the possible reasons for it?
>>>
>>> Regards
>>>
>>> On Fri, Jun 30, 2017 at 8:23 AM, John Blum <[email protected]> wrote:
>>>
>>>> Right!  There is no special configuration required to use *Java
>>>> Serialization* with Apache Geode, regardless if SDG is in play or
>>>> not.  Your application domain object just needs to implement
>>>> java.io.Serializable.
>>>>
>>>> However, if you decide to use Geode's *DataSerialization* framework
>>>> <http://geode.apache.org/docs/guide/11/developing/data_serialization/gemfire_data_serialization.html>
>>>>  [1]
>>>> or even PDX
>>>> <http://geode.apache.org/docs/guide/11/developing/data_serialization/gemfire_pdx_serialization.html>
>>>>  [2]
>>>> (and you should consider this), then SDG supports this too. For instance,
>>>> here is an example config
>>>> <https://github.com/spring-projects/spring-data-geode/blob/master/src/test/resources/org/springframework/data/gemfire/config/xml/cache-using-pdx-ns.xml#L18-L21>
>>>>  [3]
>>>> of using SDG to configure PDX.  Here is a slightly more involved
>>>> example
>>>> <https://github.com/spring-projects/spring-data-geode/blob/master/src/test/java/org/springframework/data/gemfire/function/ClientCacheFunctionExecutionWithPdxIntegrationTest.java>
>>>>  [6]
>>>> that uses *Spring* JavaConfig and "custom", "composed" *PdxSerializers*
>>>> for the application domain object types (i.e. Person & Address).
>>>>
>>>> And, if you combine Geode's PDX Serialization framework [2] with *Spring
>>>> Data's* "Mapping" infrastructure
>>>> <http://docs.spring.io/spring-data-gemfire/docs/current/reference/html/#mapping.pdx-serializer>
>>>>  [4],
>>>> there is a special PdxSerializer in SDG called MappingPdxSerializer
>>>> <http://docs.spring.io/spring-data-gemfire/docs/current/api/org/springframework/data/gemfire/mapping/MappingPdxSerializer.html>
>>>>  [5] that uses the SD "*Mapping meta-data*" to serialize your
>>>> application domain object types to PDX.
>>>>
>>>> Of *Java Serialization*, DataSerialization and PDX, it is recommended
>>>> that you use and prefer PDX as it offers the most flexibility and is more
>>>> efficient than *Java Serialization* (though it does not handle cycles;
>>>> so be careful there).  Of the 3, *DataSerialization* is the most
>>>> efficient.
>>>>
>>>> If either DataSerialization or PDX Serialization is configured, even if
>>>> your application domain object implements java.io.Serializable, then
>>>> Geode will prefer its own serialization mechanics over *Java
>>>> Serialization*.
>>>>
>>>> Refer to Geode's documentation
>>>> <http://geode.apache.org/docs/guide/11/developing/data_serialization/data_serialization_options.html>
>>>>  [7]
>>>> on serialization for more details.
>>>>
>>>> Hope this helps.
>>>>
>>>> Regards,
>>>> John
>>>>
>>>>
>>>> [1] http://geode.apache.org/docs/guide/11/developing/data_se
>>>> rialization/gemfire_data_serialization.html
>>>> [2] http://geode.apache.org/docs/guide/11/developing/data_se
>>>> rialization/gemfire_pdx_serialization.html
>>>> [3] https://github.com/spring-projects/spring-data-geode/blo
>>>> b/master/src/test/resources/org/springframework/data/gemfire
>>>> /config/xml/cache-using-pdx-ns.xml#L18-L21
>>>> [4] http://docs.spring.io/spring-data-gemfire/docs/current/r
>>>> eference/html/#mapping.pdx-serializer
>>>> [5] http://docs.spring.io/spring-data-gemfire/docs/current/a
>>>> pi/org/springframework/data/gemfire/mapping/MappingPdxSerializer.html
>>>> [6] https://github.com/spring-projects/spring-data-geode/blo
>>>> b/master/src/test/java/org/springframework/data/gemfire/func
>>>> tion/ClientCacheFunctionExecutionWithPdxIntegrationTest.java
>>>> [7] http://geode.apache.org/docs/guide/11/developing/data_se
>>>> rialization/data_serialization_options.html
>>>>
>>>>
>>>> On Thu, Jun 29, 2017 at 4:20 PM, Kirk Lund <[email protected]> wrote:
>>>>
>>>>> Make the classes for your domain objects implement
>>>>> java.io.Serializable and avoid specifying DataSerializable or
>>>>> DataSerializers or PDX. This will result in use of Java serialization when
>>>>> serializing your domain objects. It'll be slower though.
>>>>>
>>>>> On Thu, Jun 29, 2017 at 3:42 PM, Amit Pandey <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi Guys,
>>>>>>
>>>>>> Whats the config for using Java Serialization in Spring Data Geode ?
>>>>>>
>>>>>> regards
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> -John
>>>> john.blum10101 (skype)
>>>>
>>>
>>>
>>
>>
>> --
>> -John
>> john.blum10101 (skype)
>>
>
>

Reply via email to