/
ExecutionContext.java
83 lines (68 loc) · 2.46 KB
/
ExecutionContext.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.sql.exec.spi;
import org.hibernate.engine.spi.CollectionKey;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.query.spi.QueryOptions;
import org.hibernate.query.spi.QueryParameterBindings;
import org.hibernate.resource.jdbc.spi.LogicalConnectionImplementor;
import org.hibernate.sql.results.graph.entity.LoadingEntityEntry;
/**
* A context for execution of SQL statements expressed via
* SQL AST and JdbcOperation
*/
public interface ExecutionContext {
SharedSessionContractImplementor getSession();
QueryOptions getQueryOptions();
default LoadQueryInfluencers getLoadQueryInfluencers() {
return getSession().getLoadQueryInfluencers();
}
QueryParameterBindings getQueryParameterBindings();
Callback getCallback();
default String getQueryIdentifier(String sql) {
return null;
}
/**
* Get the collection key for the collection which is to be loaded immediately.
*/
default CollectionKey getCollectionKey() {
return null;
}
/**
* Should only be used when initializing a bytecode-proxy
*/
default Object getEntityInstance() {
return null;
}
default Object getEntityId() {
return null;
}
default void registerLoadingEntityEntry(EntityKey entityKey, LoadingEntityEntry entry) {
// by default do nothing
}
/**
* Hook to allow delaying calls to {@link LogicalConnectionImplementor#afterStatement()}.
* Mainly used in the case of batching and multi-table mutations
*
* todo (6.0) : come back and make sure we are calling this at appropriate times. despite the name, it should be
* called after a logical group of statements - e.g., after all of the delete statements against all of the
* tables for a particular entity
*/
default void afterStatement(LogicalConnectionImplementor logicalConnection) {
logicalConnection.afterStatement();
}
/**
* Determine if the query execution has to be considered by the {@link org.hibernate.stat.Statistics}.
*
* @return true if the query execution has to be added to the {@link org.hibernate.stat.Statistics}, false otherwise.
*/
default boolean hasQueryExecutionToBeAddedToStatistics() {
return false;
}
}