title: Calling one DAO from another DAO?
body: <p>Can this ever make sense?</p>
  
  <p>Say I need to fetch an object from the DB which has a relation to another object (represented by a foreign key in the DB, and by a composition in my domain object).  If in my first DAO I fetch the data for object 1, then call the dao for object 2, and finally (from within the first DAO, call the setter in object 1 and give it the previously fetched object 2).</p>
  
  <p>I know I could do a join instead, but it just seems more logical to me to decouple the functionality (which is why I am skeptical about calling one dao from another). Or should I move some of the logic to the service layer?</p>
  
  <p>Thanks</p>
  
  <p><strong>Update</strong>:  I think I solved the problem with help from the answers: all I needed to do was add the following to my mapping of Object 1:</p>
  
  <pre><code>&lt;one-to-one name="Object2" fetch="join"
          class="com...Object2"&gt;&lt;/one-to-one&gt;
  </code></pre>
  
  <p>I didn't have to change anything else.  Thanks for the help!</p>