References and "foreign keys" with MapDB

122 Views Asked by At

Having worked only with MySql so far, I can't understand how to manage in MapDB what in MySql I do with foreign keys. For example, if I have two (or more) ConcurrentNavigableMap with some data (like objects), how can I relate the data between these maps? What is the mechanism? MapDB docs are too concise. Thanks

1

There are 1 best solutions below

3
On

MapDB is a Key-Value Database. It does not have the notion of foreign keys. If you want to manage your data that way, your application code has to ensure that tables/maps do not contain references/keys if one key/value is deleted in the a specific map.

MapDB does not have most of the features of an SQL database, it wasn't built for that. You can check out the "embedded sql databases" in Java that exist, like Apache Derby, H2 etc. Have a look at this question and its answers: Java Embedded Databases Comparison