jankotek / mapdb

MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.
https://mapdb.org
Apache License 2.0
4.89k stars 873 forks source link

Q: how to serialize map of lists? #938

Open gadieichhorn opened 5 years ago

gadieichhorn commented 5 years ago

Hi,

I would like to use map DB for an event source database. The main event storage is a map of UUID/Key and a List of events, something like this:


Map<UUID, List<Event>> data = new HashMap<> ();

Event is an interface

How would I go about defining the treemap and serializing it?

Thanks.

icreator commented 5 years ago

make handsels serializer and use it on make Map

        map = database.createHashMap("transactions")
                .keySerializer(SerializerBase.LONG)
                .valueSerializer(new TransactionSerializer())
                .counterEnable()
                .makeOrGet();