Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@
* <p>
* This class is not thread-safe.
*
* @implNote The {@code SessionImpl} does not directly perform operations against the database or second-level cache.
* Instead, it is an {@link org.hibernate.event.spi.EventSource}, raising events which are processed by various
* implementations of the listener interfaces defined by {@link org.hibernate.event.spi}. These listeners typically
* place {@link org.hibernate.action.internal.EntityAction} instances on the {@link ActionQueue} associated with the
* session, and such actions are executed asynchronously when the session is {@linkplain #flush flushed}. The
* motivation behind this architecture is two-fold: first, it enables customization by sophisticated extensions to
* Hibernate ORM, and, second, it enables the transactional write-behind semantics of a stateful session. The stateful
* session holds its state in an instance of {@link StatefulPersistenceContext}, which we may view as the first-level
* cache associated with the session.
*
* @author Gavin King
* @author Steve Ebersole
* @author Brett Meyer
Expand Down Expand Up @@ -244,7 +254,6 @@ public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) {

final DiagnosticEvent sessionOpenEvent = getEventMonitor().beginSessionOpenEvent();
try {

persistenceContext = createPersistenceContext();
actionQueue = createActionQueue();

Expand Down Expand Up @@ -341,7 +350,10 @@ protected void applyLockOptionsHint(SelectionQuery<?> query) {

protected void applyQuerySettingsAndHints(Query<?> query) {
applyQuerySettingsAndHints( (SelectionQuery<?>) query );
applyLockTimeoutHint( query );
}

private void applyLockTimeoutHint(Query<?> query) {
final Integer specLockTimeout = LegacySpecHelper.getInteger(
HINT_SPEC_LOCK_TIMEOUT,
HINT_JAVAEE_LOCK_TIMEOUT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@
* <p>
* This class is not thread-safe.
*
* @implNote The {@code StatelessSessionImpl} is not an {@link org.hibernate.event.spi.EventSource} and does not
* make use of the usual {@linkplain org.hibernate.event.spi eventing infrastructure} to implement persistence
* operations. It does raise pre- and post- events for the benefit of integration, however. Since it performs all
* operations synchronously, it does not maintain an {@link org.hibernate.engine.spi.ActionQueue}. Therefore, it
* cannot, unfortunately, reuse the various {@link org.hibernate.action.internal.EntityAction} subtypes. This is
* a pity, since it results in some code duplication. On the other hand, a {@code StatelessSession} is easier to
* debug and understand. A {@code StatelessSession} does hold state in a long-lived {@link PersistenceContext},
* but it does temporarily keep state within an instance of {@link StatefulPersistenceContext} while processing
* the results of a given query.
*
* @author Gavin King
* @author Steve Ebersole
*/
Expand Down
Loading