net.corda.node.utilities

## Class JDBCHashMap<K,V>

- AbstractJDBCHashMap
- - net.corda.node.utilities.JDBCHashMap<K,V>

-     public class JDBCHashMap<K,V>
      extends AbstractJDBCHashMap

  A convenient JDBC table backed hash map with iteration order based on insertion order. See `class AbstractJDBCHashMap` for further implementation details.

  In this subclass, keys and values are represented by Blobs of Kryo serialized forms of the key and value objects. If you can extend `class AbstractJDBCHashMap` and implement less Kryo dependent key and/or value mappings then that is likely preferrable.

  See Also:
    `class AbstractJDBCHashMap`, `class AbstractJDBCHashMap`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JDBCHashMap.BlobMapTable`

    - ### Nested classes/interfaces inherited from class net.corda.node.utilities.AbstractJDBCHashMap

      `AbstractJDBCHashMap.Companion`

  - ### Field Summary

    - ### Fields inherited from class net.corda.node.utilities.AbstractJDBCHashMap

      `Companion`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JDBCHashMap(java.lang.String tableName, boolean loadOnInit, int maxBuckets)` A convenient JDBC table backed hash map with iteration order based on insertion order. See `class AbstractJDBCHashMap` for further implementation details.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addKeyToInsert(org.jetbrains.exposed.sql.statements.InsertStatement insert, java.util.Map.Entry<? extends K,? extends V> entry, java.util.List<kotlin.jvm.functions.Function0> finalizables)` Implementation should marshall the key to the insert statement.
    `void` | `addValueToInsert(org.jetbrains.exposed.sql.statements.InsertStatement insert, java.util.Map.Entry<? extends K,? extends V> entry, java.util.List<kotlin.jvm.functions.Function0> finalizables)` Implementation should marshall the value to the insert statement.
    `K` | `keyFromRow(org.jetbrains.exposed.sql.ResultRow row)` Implementation should return the key object marshalled from the database table row.
    `V` | `valueFromRow(org.jetbrains.exposed.sql.ResultRow row)` Implementation should return the value object marshalled from the database table row.

    - ### Methods inherited from class net.corda.node.utilities.AbstractJDBCHashMap

      `addKeyToInsert, addValueToInsert, clear, containsKey, containsValue, entrySet, get, getEntries, getKeys, getLoadOnInit, getMaxBuckets, getSize, getTable, getValues, isEmpty, keyFromRow, keySet, put, remove, size, valueFromRow, values`

- - ### Constructor Detail

    - #### JDBCHashMap

          public JDBCHashMap(java.lang.String tableName,
                             boolean loadOnInit,
                             int maxBuckets)

      A convenient JDBC table backed hash map with iteration order based on insertion order. See `class AbstractJDBCHashMap` for further implementation details.

      In this subclass, keys and values are represented by Blobs of Kryo serialized forms of the key and value objects. If you can extend `class AbstractJDBCHashMap` and implement less Kryo dependent key and/or value mappings then that is likely preferrable.

      See Also:
        `class AbstractJDBCHashMap`, `class AbstractJDBCHashMap`

  - ### Method Detail

    - #### keyFromRow

          public K keyFromRow(org.jetbrains.exposed.sql.ResultRow row)

      Implementation should return the key object marshalled from the database table row.

      See example implementations in `class JDBCHashMap`.

      See Also:
        `class JDBCHashMap`

    - #### valueFromRow

          public V valueFromRow(org.jetbrains.exposed.sql.ResultRow row)

      Implementation should return the value object marshalled from the database table row.

      See example implementations in `class JDBCHashMap`.

      See Also:
        `class JDBCHashMap`

    - #### addKeyToInsert

          public void addKeyToInsert(org.jetbrains.exposed.sql.statements.InsertStatement insert,
                                     java.util.Map.Entry<? extends K,? extends V> entry,
                                     java.util.List<kotlin.jvm.functions.Function0> finalizables)

      Implementation should marshall the key to the insert statement.

      If some cleanup is required after the insert statement is executed, such as closing a Blob, then add a closure to the finalizables to do so.

      See example implementations in `class JDBCHashMap`.

      See Also:
        `class JDBCHashMap`

    - #### addValueToInsert

          public void addValueToInsert(org.jetbrains.exposed.sql.statements.InsertStatement insert,
                                       java.util.Map.Entry<? extends K,? extends V> entry,
                                       java.util.List<kotlin.jvm.functions.Function0> finalizables)

      Implementation should marshall the value to the insert statement.

      If some cleanup is required after the insert statement is executed, such as closing a Blob, then add a closure to the finalizables to do so.

      See example implementations in `class JDBCHashMap`.

      See Also:
        `class JDBCHashMap`