code: public long addPerson( final String name )
      {
          try ( Session session = driver.session() )
          {
              session.writeTransaction( new TransactionWork<Void>()
              {
                  @Override
                  public Void execute( Transaction tx )
                  {
                      return createPersonNode( tx, name );
                  }
              } );
              return session.readTransaction( new TransactionWork<Long>()
              {
                  @Override
                  public Long execute( Transaction tx )
                  {
                      return matchPersonNode( tx, name );
                  }
              } );
          }
      }
docs: tag::read-write-transaction[]