My code obtains Connection c on its own. A Session s is opened with the Connection c.
Then, s.save(object1);s.save(object2);....s.close()....c.commit();
Against mysql, it looks like the entire "transaction" got rolled back.
The doc says, Transaction tx = s.beginTransaction .... t.commit(); s.close(), so I figure my approach is totally wacked right?
But well, what if I wanted to do something custom to the connection c and I needed to do that in a different scope than Session s?
In other words, I want to get a Session s with a custom Connection c, use s to persist a few objects, close s, then continue to work using c, then c.commit...that would not work right?
|