Hi Dmitry,

I can't advise a lot on implementation details, but generally I don't think
that CacheJdbcPojoStore should ever work with POJO classes in case binary
marshaller is enabled. It should always work directly with binary objects
even if POJOs are on server classpath, and switch to POJOs only when other
marshaller is used.

Makes sense?

-Val

On Tue, Apr 11, 2017 at 12:06 PM, Dmitriy Govorukhin <
[email protected]> wrote:

> Hi all,
>
> I found problem related to CacheJdbcPojoStore. If try to load data, with
> enabled binary marshaller,
> error may occur. Problem in entryMappings (this map helps resolve stored
> type when data loading).
> If binary marshaller disable we just  put entry with java type in this map,
> if enable we put java type + binary type.
>
> ......
>
>    checkTypeConfiguration(cacheName, valKind, valType,
> type.getValueFields());
>
>    entryMappings.put(keyTypeId, new EntryMapping(cacheName, dialect, type,
> keyKind, valKind, sqlEscapeAll));
>
>    // Add one more binding to binary typeId for POJOs,
>    // because object could be passed to store in binary format.
>    if (binarySupported && keyKind == TypeKind.POJO) {
>        keyTypeId = typeIdForTypeName(TypeKind.BINARY, keyType);
>
>        valKind = valKind == TypeKind.POJO ? TypeKind.BINARY : valKind;
>
>        entryMappings.put(keyTypeId, new EntryMapping(cacheName, dialect,
> type, TypeKind.BINARY, valKind, sqlEscapeAll));
>     }
>
> .......
>
>
> I think it is wrong, because after we use this map like  iterator for load,
> and final result dependent from which mapping will be first java or binary.
>
> Collection<String> processedKeyTypes = new HashSet<>();
>
>     for (EntryMapping em : mappings.values()) {
>         String keyType = em.keyType();
>
>         if (processedKeyTypes.contains(keyType))
>             continue;
>
>     processedKeyTypes.add(keyType);
>
> .....
>
> I think we must add only binary mapping for user pojo if binary marshaller
> enable.
>

Reply via email to