title: How can I use Redisson Write-through caching strategy with an auto-generated PK
body: <p>I am planning to use Redis with Redisson as a caching layer between my Java app and a PostgreSQL DB. 
  I have a table called Nodes looking like this:</p>
  
  <pre><code>CREATE TABLE nodes
  (
  node_id bigint GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1),
  node_name varchar(100) NOT NULL,
  PRIMARY KEY (node_id)
  )
  </code></pre>
  
  <p>I want to use <a href="https://github.com/redisson/redisson/wiki/7.-Distributed-collections#712-map-persistence" rel="nofollow noreferrer">Redisson RMap persistence</a> to cache this structure. 
  My goal is to have an rmap looking like this:</p>
  
  <pre><code>Rmap&lt;Integer, Node&gt; 
  </code></pre>
  
  <p>where the key is the PK, and the value is the node itself.</p>
  
  <p>I want to use read-through and write-trhough strategies for caching this Rmap, by using the MapLoader and the MapWriter.</p>
  
  <p>Then, I want to have a Java method which should create and persist a node. </p>
  
  <pre><code>public void createNode(String nodeName) {
    Node node = new Node();
    node.setName(nodeName);
  
    // how can I put elements in the rmap since, 
    // the PK will be available after the INSERT statement will run?
    rmap.put(?, node);
  }
  </code></pre>
  
  <p>And here comes the problem. Since the PK is auto-generated from Postgres, how can I use the RMapWriter to insert a node, since, for putting elements in the RMap I need the key, which I don't have until the insert statement will run?</p>