title: how to save or update multiple entity objects at a time in hibernate...?
body: <p>Consider that there is no relationship between both the table Employee and Manager(both tables taken for just demo). Just i have to know how we can save or update multiple entity object simultaneously. I dont know whether my approach is wrong or right.</p>
  
  <blockquote>
    <p>Session session = getSession();<br>
    Transaction tx = session.beginTransaction(); <br>
    String hql = "from Employee e where e.id = :empId";<br>
    Query query = session.createQuery(hql);<br>
    query.setString("empId", 1);<br>
    Employee emp= (Employee)query.uniqueResult();<br><br>
    emp.setStatus("Inactive");<br>
    session.saveOrUpdate(emp);<br></p>
    
    <p>hql = "from Manager where m.id = :mgrId";<br>
    Query query = session.createQuery(hql);<br>
    query.setString("mgrId", 100);<br>
    Manager mgr= (Manager)query.uniqueResult();<br><br>
    mgr.setStatus("Active");<br>
    session.saveOrUpdate(mgr);<br>
    tx.commit();</p>
  </blockquote>