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_
> serialization/gemfire_data_serialization.html
> [2] http://geode.apache.org/docs/guide/11/developing/data_
> serialization/gemfire_pdx_serialization.html
> [3] 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
> [4] http://docs.spring.io/spring-data-gemfire/docs/
> current/reference/html/#mapping.pdx-serializer
> [5] http://docs.spring.io/spring-data-gemfire/docs/current/api/org/
> springframework/data/gemfire/mapping/MappingPdxSerializer.html
> [6] https://github.com/spring-projects/spring-data-geode/
> blob/master/src/test/java/org/springframework/data/gemfire/function/
> ClientCacheFunctionExecutionWithPdxIntegrationTest.java
> [7] http://geode.apache.org/docs/guide/11/developing/data_
> serialization/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)
>

Reply via email to