Is it bad practice in Hibernate to update an Object in a different Session than it was originally created in? I think the answer is yes, because a Hibernate Session (by default) will cache its Session Objects, and release them when the Session is closed or the Object is evicted. So creating an Object in one Session then updating it in another Session (while the Object is still 'alive' in the first Session) seems like bad practice to me. Can anyone explain why, what are the repercussions? For example, consider this code (which is shortened for clarity):
private void updateRequest(Request req){ //Request came from another Hibernate Session
MyDAO myDB = null;
myDB = new MyDAO();
Transaction trans = myDB.getSession().beginTransaction();
myDB.getSession().update(object);
trans.commit();
}