What state is hibernate object in after commit?
<p>Going through this tutorial</p>

<p>"Once the session is ended, the persistence object set to detached object"</p>

<p>my question is what happens if you begin another transaction after the first commit but before closing the session. what state is the user object in at this point? </p>

<pre><code>public static void main(String[] args) {
    System.out.println("Maven + Hibernate + Oracle"); 
    Session session = HibernateUtil.getSessionFactory().openSession();   
    session.beginTransaction();
    DBUser user = new DBUser(); //creating transient object
    user.setUserId(104); 
    user.setUsername("user1");
    user.setCreatedBy("system");
    user.setCreatedDate(new Date());  
    session.saveOrUpdate(user);  //Updating the transient object to persistence object
    session.getTransaction().commit(); 

    session.beginTransaction();
    user.setUsername("user2"); //what state is user object in right now?
    session.saveOrUpdate(user);
    session.getTransaction().commit();
    session.close();
}
</code></pre>