Hi, I am starting with Coherence and I am having a hard time trying to introduce POF serialization in a complex hierarchy of classes... classes containing another classes that extend abstract classes that extend another abstract classes... All of them add up to 500 classes... I tried using PortableObject and Cohclipse to generate automatically the readExternal and writeExternal methods but I noticed that I missed that data of the attributes contained in the abstract classes. I thought that it might be because I repeated in the subclass the indexes for the attributes of the abstract class but I changed it and it is still not working. Besides I have problems with Enums...
I just wanted to know which would be the best approach to this kind of task because I am trying to look for posible solutions in google but all I can find are just very simple examples... If you could give me any advise I would really appretiate it. Thanks
POF is not really very good for class hierarchies - as you have discovered. It is possible to use it but requires some care to do it manually. You might want to check out some of the work that Aleks Seovic did on fixing this on the Oracle Coherence You Tube channel here: http://www.youtube.com/watch?v=7egLQwsvuNg
In Coherence 3.7 you can use annotations for por serialization, Coherence introduced two annotation: Portable and PortableProperty, that could make it for you easy to add por serialization without writing read/write external methods. Also it can automatically set the indexes so you avoid messing witht hem.
Thanks a lot,
But the POF annotations will not help with the original question - which was about serializing complex class hierarchies. The annotations are good (albeit with some limitations) but really they just save you writing code, they don't fix the limitations or difficulties of supporting class hierarchies.