A very common use case:
Suppose there's an entity called "MyEntity.java" like this.
There's three typical attributes in it. An objectA, an objectB, and a list of objectA. I need to serialize them all as a json format into the database, which means that I have to define my own type handler, as below.
But now there's a conflict.
I have to set the @MappedTypes for my type handlers, as Jackson needs the type-reference to which it deserializes into, and when Mybatis instantiates the type handlers, it just assigns to the generic with the classes defined in @MappedTypes.value one by one, which means that value wrote afterwards would overwrite those wrote forwards.
That is, for example, ALL_TYPE_HANDLER_MAP will only persist MyObjectTypeHandler<ObjectB> for class name "MyObjectTypeHandler", which means that I cannot use MyObjectTypeHandler for attribute objectA manually.
Meanwhile, in map TYPE_HANDLER_MAP, MyListTypeHandler<ObjectA> overwrites MyObjectTypeHandler<ObjectA> with key "ObjectA", which means that I cannot use MyObjectTypeHandler for attribute objectA automatically.
Codes shown below.