SessionTerminatedException
Exception thrown when the server ends the session: it sent a FATAL or a PANIC, and closed the connection behind it.
The session goes with it: nothing sent on it afterwards reaches a server, a pool evicts the connection, and whatever the transaction had not committed is gone. Retrying means starting again on a new session. A statement the server cancels is ExecutionAbortedException instead, and leaves the session usable.
The type is decided by the severity rather than by the SQLSTATE, because the severity is what says the connection is gone - whatever the code, a FATAL is the last thing the server sends. The code names the cause for the ones an application would tell apart, and SessionTerminatedExceptionReason.UNKNOWN carries the rest with the code intact.
Only a session that was open is terminated. A FATAL during login is the server refusing one, and is an InitializationException.
Parameters
The SQL state code returned by the database.
The original error message from the database server.
Constructors
Properties
Where this happened, innermost first, appended to by each layer as the exception unwinds. It is on the base class for the same reason queryContext is: adding to it is the only thing a frame can do to an exception without replacing it, and replacing one costs the type the caller catches on - a ConstraintViolationException restated as something else stops being the failure a retry looks for. A mapper walking a nested composite appends the attribute it was on, a transaction plan the step and parameter it was resolving. Rendered reversed, outermost first, so PATH: step 1 -> parameter 'name' -> map #1 reads from the plan down to the lambda.
The context of the query that resulted in this exception, if applicable.
Why the server ended the session.
The raw error message received from the database, if applicable.