Is there any difference in which order I createCriteria and beginTransaction using Hibernate?
- by user2519543
Just wondering is there any difference when I beginTransaction [org.hibernate] before or after creating Criteria/Query etc.?
example 1:
...
Transaction tx= session.beginTransaction();
Criteria c = session.createCriteria(class);
result = c.uniqueResult();
tx.commit();
...
example 2:
...
Criteria c = session.createCriteria(class);
Transaction tx= session.beginTransaction();
result = c.uniqueResult();
tx.commit();
...
Thanks.