title: Greendao: insert, update, delete Syntax, Best practice
body: <p>I have asked similar question here but i didnt got any satisfactory response, so please understand my concern:  </p>
  
  <pre><code>    1. https://stackoverflow.com/questions/14846105/insert-ot-update-using-one-of-the-field-as-key-in-greendao
      2. https://stackoverflow.com/questions/14547288/best-way-to-select-row-with-following-scenario-using-greendao
  </code></pre>
  
  <p>I have a table called <strong>"TARGET"</strong> both on Server and Client.<br>
  Here Server is MySql and Client is Android.</p>
  
  <p>I wanted to use <strong>greendao</strong> for the client part, 
  I have multiple tasks todo that are as follows:</p>
  
  <ol>
  <li>Employee with some <strong>EMPLOYEE_ID</strong> will get all the targets from the server after certain date, Now
  in the client part if the <strong>TARGET</strong> is present then it should be updated, else inserted.
  This is <strong>insertOrUpdate</strong> Case.</li>
  <li>Delete certain target using <strong>TARGET_ID.</strong></li>
  <li>Get the list of TARGET's using the <strong>TARGET_NAME</strong>.  </li>
  </ol>
  
  <p>Data Regarding Question:  </p>
  
  <pre><code>    TABLE : TARGET
      FIELDS: TARGET_ID
              TARGET_NAME
              EMPLOYEE_ID
  </code></pre>
  
  <p>Used below code in DaoExampleGenerator:<br>
  <a href="https://stackoverflow.com/questions/14547288/best-way-to-select-row-with-following-scenario-using-greendao">Best way to select row with following scenario using greenDao?</a></p>
  
  <pre><code>    private static void addTarget(Schema schema){
          Entity target = schema.addEntity("TARGET");
          target.addStringProperty("TARGET_ID").primaryKey().autoincrement();
          target.addStringProperty("TARGET_NAME");
          target.addStringProperty("EMPLOYEE_ID");
      }
  </code></pre>
  
  <p>Below is what i have done for the questions i haved posted:  </p>
  
  <pre><code>    1. tDao.insertOrReplaceInTx(tArrayList);
         where, tArrayList is ArrayList of TARGET Object.
      2. for deleting a target using TARGET_ID, i load all the targets in     
         ArrayList&lt;TARGET&gt; then check TARGET_ID of each TARGET object. If 
         the TARGET_ID matches then i use, **tDao.delete(t);**
      3. for this also i do the same as (2), i load all the targets then match 
         the TARGET_NAME, If it matches then i add it to list.
  </code></pre>
  
  <p>Can Anyone please tell me best possible ways to implement above problem statements.
  using <strong>greendao</strong> ?</p>