Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate - Forcing container resource cleanup on transaction completion

Tags:

java

hibernate

After a few queries get executed I'm getting the following message from Hibernate:

HHH000106: Forcing container resource cleanup on transaction completion

Everything seems to be working fine, there are no errors, but I haven't found any explanation as to what this message means, or if I should do anything about it.

I'm using Hibernate/JPA with JTA global transactions.

Any ideas?

like image 711
Vedran Avatar asked Mar 04 '13 12:03

Vedran


2 Answers

(To complete xwoker's answer.)

The resources we are talking about are:

  • ResultSet
  • Statement

This message occurs because you left some of those resources open i.e. you didn't call their close() method. Due to the current ConnectionReleaseMode: those resources became useless and Hibernate informs you that it is calling the close() method for you.

To avoid this log: just call the close() method (on your ResultSet(s) and Statement(s)) yourself before the end of the transaction.

like image 181
ben75 Avatar answered Oct 19 '22 11:10

ben75


This message is produced in the org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl (at least is that the only place I found it used) and is declared as INFO:

public void afterTransaction() {
    transactionTimeOutInstant = -1;
    if ( connectionReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT ||
            connectionReleaseMode() == ConnectionReleaseMode.AFTER_TRANSACTION ) {
        if ( hasRegisteredResources() ) {
            LOG.forcingContainerResourceCleanup();
            releaseResources();
        }
        getLogicalConnection().aggressiveRelease();
    }
}

If certain ConnectionReleaseModes are used and there are registered resources, Hibernate informs you, that it releases these resources.

If this is the desired behaviour, don't do anything about it.

like image 30
xwoker Avatar answered Oct 19 '22 11:10

xwoker