After many reading (
http://hibernate.org/42.html and "Java Persistence book", chap. 10.3 and 16), I didn't found any answer to my question...
I know that autcommit isn't a great solution but I would like to try it on my readonly DB. The main goal is to avoid the "manual management" of Session and Transaction. So I'm wondering if using the following code, Transaction and Session are automatically closed when autocommit is set to on:
Code:
Session session = hibConnection.getSessionFactory().getCurrentSession();
session.beginTransaction();
MyDAO daoObj = session.createCriteria(myClass.class)
.add(Restrictions.between("createTime", start, end))
.list();
In this code, I never end the current Transaction and Session, and I don't know if the autocommit is doing it for me, and when ?
I know that Tx management should be done arround the service management in a Middleware (3-tier) application but I would like to try the autocommit way too..
Many thanks in advance !
Joël