File tree Expand file tree Collapse file tree 5 files changed +116
-0
lines changed
hibernate-core/src/main/java/org/hibernate Expand file tree Collapse file tree 5 files changed +116
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate ;
6
+
7
+
8
+ import jakarta .persistence .EntityGraph ;
9
+ import jakarta .persistence .FindOption ;
10
+
11
+ import java .util .List ;
12
+
13
+ /**
14
+ * MultiFindOption implementation to specify whether the returned list
15
+ * of entity instances should contain instances that have been
16
+ * {@linkplain Session#remove(Object) marked for removal} in the
17
+ * current session, but not yet deleted in the database.
18
+ * <p>
19
+ * The default is {@link #EXCLUDE}, meaning that instances marked for
20
+ * removal are replaced by null in the returned list of entities when {@link OrderedReturn}
21
+ * is used.
22
+ *
23
+ * @see org.hibernate.MultiFindOption
24
+ * @see OrderedReturn
25
+ * @see org.hibernate.Session#findMultiple(Class, List, FindOption...)
26
+ * @see org.hibernate.Session#findMultiple(EntityGraph, List , FindOption...)
27
+ */
28
+ public enum IncludeRemovals implements MultiFindOption {
29
+ INCLUDE ,
30
+ EXCLUDE
31
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate ;
6
+
7
+
8
+ import jakarta .persistence .FindOption ;
9
+
10
+ /**
11
+ * Simple marker interface for FindOptions which can be applied to multiple id loading.
12
+ */
13
+ interface MultiFindOption extends FindOption {
14
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate ;
6
+
7
+
8
+ import jakarta .persistence .EntityGraph ;
9
+ import jakarta .persistence .FindOption ;
10
+
11
+ import java .util .List ;
12
+
13
+ /**
14
+ * MultiFindOption implementation to specify whether the returned list
15
+ * of entity instances should be ordered, where the position of an entity
16
+ * instance is determined by the position of its identifier
17
+ * in the list of ids passed to {@code findMultiple(...)}.
18
+ * <p>
19
+ * The default is {@link #ORDERED}, meaning the positions of the entities
20
+ * in the returned list correspond to the positions of their ids. In this case,
21
+ * the {@link IncludeRemovals} handling of entities marked for removal
22
+ * becomes important.
23
+ *
24
+ * @see org.hibernate.MultiFindOption
25
+ * @see IncludeRemovals
26
+ * @see org.hibernate.Session#findMultiple(Class, List, FindOption...)
27
+ * @see org.hibernate.Session#findMultiple(EntityGraph, List , FindOption...)
28
+ */
29
+ public enum OrderedReturn implements MultiFindOption {
30
+ ORDERED ,
31
+ UNORDERED
32
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ * Copyright Red Hat Inc. and Hibernate Authors
4
+ */
5
+ package org .hibernate ;
6
+
7
+
8
+ import jakarta .persistence .EntityGraph ;
9
+ import jakarta .persistence .FindOption ;
10
+
11
+ import java .util .List ;
12
+
13
+ /**
14
+ * MultiFindOption implementation to specify whether the ids of managed entity instances already
15
+ * cached in the current persistence context should be excluded.
16
+ * from the list of ids sent to the database.
17
+ * <p>
18
+ * The default is {@link #DISABLED}, meaning all ids are included and sent to the database.
19
+ *
20
+ * Use {@link #ENABLED} to exclude already managed entity instance ids from
21
+ * the list of ids sent to the database.
22
+ *
23
+ * @see org.hibernate.MultiFindOption
24
+ * @see org.hibernate.Session#findMultiple(Class, List , FindOption...)
25
+ * @see org.hibernate.Session#findMultiple(EntityGraph, List , FindOption...)
26
+ */
27
+ public enum SessionChecking implements MultiFindOption {
28
+ ENABLED ,
29
+ DISABLED
30
+ }
Original file line number Diff line number Diff line change @@ -964,6 +964,15 @@ else if ( option instanceof ReadOnlyMode ) {
964
964
else if ( option instanceof BatchSize batchSizeOption ) {
965
965
batchSize = batchSizeOption .batchSize ();
966
966
}
967
+ else if ( option instanceof SessionChecking sessionChecking ) {
968
+ loadAccess .enableSessionCheck ( option == sessionChecking .ENABLED );
969
+ }
970
+ else if ( option instanceof OrderedReturn orderedReturn ) {
971
+ loadAccess .enableOrderedReturn ( option == orderedReturn .ORDERED );
972
+ }
973
+ else if ( option instanceof IncludeRemovals includeRemovals ) {
974
+ loadAccess .enableReturnOfDeletedEntities ( option == includeRemovals .INCLUDE );
975
+ }
967
976
}
968
977
loadAccess .with ( lockOptions )
969
978
.with ( interpretCacheMode ( storeMode , retrieveMode ) )
You can’t perform that action at this time.
0 commit comments