title: Obtaining a nested objects using Spring Data R2DBC
body: <p>I'm new to Project Reactor and R2DBC. How to receive and merge <code>Flux&lt;Child&gt;</code> with <code>Mono&lt;Parent&gt;</code> properly using Spring Data R2DBC reactive repositories?</p>
  
  <p>Parent:</p>
  
  <pre><code>@Table("parent")
  public class Parent{
  
  @Id
  private Long id;
  private String name;
  
  @Transient
  private Flux&lt;Child&gt; children;
  </code></pre>
  
  <p>ParentRepository:</p>
  
  <pre><code>interface ParentRepository extends ReactiveCrudRepository&lt;Parent, Long&gt; {
  
  @Query()
  Mono&lt;Parent&gt; findOneByName(String name);
  </code></pre>
  
  <p>Child:</p>
  
  <pre><code>@Table("child")
  public class Child{
  
  @Id
  private Long id;
  </code></pre>
  
  <p>ChildRepository:</p>
  
  <pre><code>interface ChildRepository extends ReactiveCrudRepository&lt;Child, Long&gt; {
  
  @Query()
  Flux&lt;Child&gt; findAllByParentId(Long parentId);
  </code></pre>
  
  <p>ParentPersistenceAdapter:</p>
  
  <pre><code>public Mono&lt;Parent&gt; findParent(String parentName) {
      return parentRepository.findOneByName(parentName)
        //how to invoke childRepository.findAllByParentId()
        //and set this Flux to Parent's Mono
  
  }
  </code></pre>
  
  <p>My solution is:</p>
  
  <pre><code>public Mono&lt;Parent&gt; findParent(String parentName) {
      return parentRepository.findOneByName(parentName)
        .map(parent -&gt; {
              Flux&lt;Child&gt; children = childRepository.findAllByParentId(parent.getId())
              children.subscribe();
              return parent.setChildren(children );
          });      
  }
  </code></pre>