Chamly Idunil
Chamly Idunil

Reputation: 1872

is getHibernateTemplate().flush() release data base connection

Please let me to know is getHibernateTemplate().flush() release data base connection after commit. If not what is the procedure to release data base connection.

I cant use hibernate transaction manager to resolve this.

Upvotes: 2

Views: 983

Answers (2)

18bytes
18bytes

Reputation: 6029

getHibernateTemplate().flush() will not release DB connection after commit. flush() will just synchronize your persistence context state with DB by firing update queries.

Connection will be closed when the hibernate session ends. However you can start a new transaction once the current one finishes.

Additional reference: function of getHibernateTemplate().flush()

Upvotes: 0

M. Deinum
M. Deinum

Reputation: 124898

calling flush be it on the HibernateTemplate or Session doesn't release anything it will only flush the pending sql statements to the database.

A connection will be releases as soon as the Session is closed, when this is depends on your setup.

Note: HibernateTemplate should be considered deprecated as of Hibernate 3.0.1 (this is when contextual sessions where introduced) and you should favor plain Session usage of the HibernateTemplate.

Upvotes: 2

Related Questions