Is the Session threadsafe in Hibernate ?
-
True
-
False
-
No matter
-
None of the above
B
Correct answer
Explanation
Hibernate Session is a non-thread-safe object representing a single database transaction/unit of work and must not be shared. If multiple threads access a session concurrently, it causes race conditions and data corruption. Conversely, SessionFactory is thread-safe and designed for global, multi-threaded use.