Skip to content

SerializationType.CUSTOM problems #27

@GoogleCodeExporter

Description

@GoogleCodeExporter

This is a complementary issue to #25

> I don't think that we should modify behavior of Cacheable annotation because 
it's not a part of SSM but Spring. > If you want such feature you should 
request it from Spring team then SSM will support it out of the box.
> In raw SSM there is a workaround. You can use SerializationType.CUSTOM and 
register custom cache transcoder > using CacheFactory. In the transcoder you 
can define how to serialize and deserialize objects of given type.

I started to use SerializationType.CUSTOM but I have encountered some problems. 
But before I would like to summarise my use case: I had an inmemory entity map 
and want to use cache for complicated queries. But instead of persisting all 
entities in cache I would like to store only id's in map. Here is signature of 
one of my service method.

   List<VideoInfo> getWeeklyMostPopularVideosByCategoryId(Long categoryId, Boolean homePageAndSearchRestricted, Integer limit);

I would like to store List<Integer> in my cache instead of List<VideoInfo>. I 
am already using an inmemory store and this way I will reduce the serialization 
cost of my entities.

Here is the questions:

1. com.google.code.ssm.spring.SSMCache#put is calling null SerializationType. 
Is this expected? I was expecting to a resolving strategy for SerializationType.

2. My entities are in 3rd party clients. I can not modify them. (I also think 
that not polluting entities by library annotations such as Json annotation, JPA 
or Cache is a good practice.) Is there a way to register each entity by 
CacheFactory like this: 

CacheFactory.registerSerializationType(MyEntity.class,  
SerializationType.CUSTOM);

3. How can I provide custom serialization for Collection<MyEntity> types. What 
I would like to do is using provided serialization for Collection types but 
custom serialization for my entities.

Thanks

Original issue reported on code.google.com by cemalettin.koc@gmail.com on 3 Feb 2014 at 2:58

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions