jankotek / jankotek/mapdb

Kotlin concurrent map not storing custom object

Open
#862 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

4.0 document
Dominant language
Java
Stars
5.1k
Forks
877
PR merge metrics
No merged PRs in 30d

Description

In java it is possible to write the following:

ConcurrentMap<Int, AnswerData> map = db.hashMap("map").createOrOpen();

I tried to use following in kotlin, but the objectes stored are not serialised & stored correctly. They are not filled after reading.

val db = DBMaker.fileDB("file.db").make()
val map = db.hashMap("mymap").createOrOpen() as ConcurrentMap<Int, AnswerData>
map.put(5, mayAnswerData)
db.close()

How is it done in kotlin? Would be nice if you could make more examples which show how to use for example custom objects.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Kotlin example using DBMaker.fileDB, hashMap, createOrOpen, and ConcurrentMap, then review how MapDB handles custom-object serialization across close and reopen. Done means documenting a working Kotlin custom-object example and verifying that the stored object is populated after reading it back.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
databases, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.