session « Validation « JPA Q&A





1. Validate a session    forum.hibernate.org

Hi, im doing transaction management, my code looks something like this SessionFactory fact = getSessionFactory(); sess = fact.openSession(); tr = sess.beginTransaction(); MTSUserImpl user = (MTSUserImpl) sess.get(MTSUserImpl.class, new String("Marc")); sess.setLocation("Boston"); sess.update(user); MTSUserImpl user1 = new MTSUserImpl(); user1.setUserID("andy"); user1.setOperatorID("aa"); user1.setLocation("NYC"); sess.save(user1); tr.commit(); sess.close(); Now my problem is that its only at tr.commit() when i get to know if the session is valid, in ...