title: How to create deep entity with oModel.createEntry
body: <p>Is there a way to create a "temporary" (or I guess it's called virtual) deep entity with using <code>oModel.createEntity()</code>?</p>
  
  <p>I have a entity called Timesheet with an association to breaks, called ToBreaks.</p>
  
  <p>Now I want to create a new entity in the frontend by using
  <code>oModel.createEntity("/TimesheetSet")</code>. </p>
  
  <p>Unfortunately in the so called virtual new entry all my associations are missing.
  Because I use the assications for binding tables, after creating the virtual new entry, a backend call is triggered
  <code>TimesheetSet("id-04-123456789")/ToBreaks</code> which leads to a "invalid key predicate" error.</p>
  
  <p>Is there a way to do this with OData V2?</p>
  
  <p><strong>Update 09.08.2016:</strong></p>
  
  <blockquote>
    <p>You can still try by just using the properties parameter with a nested entity set. As long as your OData service supports the corresponding deep create it should work:</p>
  </blockquote>
  
  <p>I've also tried something like this:</p>
  
  <pre><code>oModel.createEntry("/TimesheetEntry", {
      Pernr: sPernr,
      Begda: dBegda,
      ToBreaks: [{
          Pernr: sPernr,
          Begda: dBegda
      }]
  });
  </code></pre>
  
  <p><code>ToBreaks</code> is the name of the association.</p>
  
  <p>In the virtual entry of the OData-Model the properties for the associations are still missing. I can create the new entry by using the code above, but afterwards there is no property called <code>ToBreaks</code></p>
  
  <p>On the Backend-Side I followed this tutorial for implementing the deep_create method: <a href="http://scn.sap.com/community/gateway/blog/2014/04/27/step-by-step-development-guide-for-createdeepentity-operation" rel="nofollow">step-by-step-development-guide-for-createdeepentity-operation</a>. I'm able to trigger the method from within the SAP Gateway Client. </p>