user1409534
user1409534

Reputation: 2304

log impkicit transaction Hibernate

I'm reading from db via Hibernate in auto-commit mode

I don't declare transaction boundaries explicitly, then, as far as I know, the read query will be executed in a separate transaction.

I use the following code to read :

        ScrollableResults scrollableResults = 
        entityManager.unwrap(Session.class).createQuery("Select 
        m from Message m ").scroll();
        while (scrollableResults.next()) {
           //do things
        }

How can I log the beginning and committing the implicit transaction? I try to use p6spy but I don't get anything relating to transaction

Upvotes: 0

Views: 60

Answers (1)

Christian Beikov
Christian Beikov

Reputation: 16430

Because auto-commit is something that happens within the driver. Such a spy works by wrapping the connection and intercepting all external uses of the driver, but you can't see what is happening internally. If you want to know what happens on the inside, you have to look into your database log or at the network traffic.

Upvotes: 1

Related Questions