Hibernate Session ID

I am working on a large enterprise application that has many hibernation calls to the database. I want to keep track of which session is open and which is closed.

So, there is something in sleep mode, we can get a unique identifier for this session or something else. The basic idea is to track session runtime. I checked a lot of profilers, but did not give the correct output.

+6
source share
4 answers

What about the Hibernate session hash code?

0
source

Use System.identityHashCode(session) to look up the memory address, and then you can determine if it is using the same session in a different way or not.

0
source

You can use session.toString() to display the session ID and its status, open or close.

0
source

Source: https://habr.com/ru/post/1501528/


All Articles