title: When OpenJPA query executes and what is order
body: <p>I am banging my head on an issue with OpenJPA.</p>
  
  <p>I have a method:</p>
  
  <pre><code>public void update() {
      System.out.println("START: Update...");
      updateEmployee(employee);
      updateStudent(student);
      System.out.println("END: Update...");
  }
  updateEmployee(employee) {
     employeeDAO.update(employee);
  }
  
  updateStudent(student) {
      studentDAO.update(student);
  }
  </code></pre>
  
  <p>But when I run this I am getting logs like this:</p>
  
  <p>START: Update...
  <br/>
  update com.sk.entity.Employee e set ...
  <br/>
  update com.sk.entity.Student s set ...
  <br/>
  END: Update...
  <br/>
  openjpa.jdbc.SQL -  executing prepstmnt 2036496738 <b>UPDATE STUDENT SET... </b>
  <br/>
  openjpa.jdbc.SQL -  executing prepstmnt 2036496738 <b>UPDATE EMPLOYEE SET ...</b>
  <br/></p>
  
  <p>Here I am still not getting:</p>
  
  <ul>
  <li><p>why the update queries are not executed as soon as I am calling updateEmplyoee method. You can see the log that the sql are printed after my log statement "END: Update..."</p></li>
  <li><p>why STUDENT table is getting updated first. As per method calling I am calling updateEmployee at first</p></li>
  </ul>
  
  <p>Can anyone please reply if you know what I am missing.</p>