-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
HHH-19829 - Deprecate MultiIdentifierLoadAccess and the Session.byMultipleIds() methods #11070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0530f02
5c0b942
54c2d38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,21 +11,32 @@ | |
import java.util.List; | ||
|
||
/** | ||
* MultiFindOption implementation to specify whether the returned list | ||
* of entity instances should contain instances that have been | ||
* {@linkplain Session#remove(Object) marked for removal} in the | ||
* current session, but not yet deleted in the database. | ||
* When {@linkplain SessionChecking} is enabled, this option controls how | ||
* to handle entities which are already contained by the persistence context | ||
* but which are in a removed state (marked for removal, but not yet flushed). | ||
* <p> | ||
* The default is {@link #EXCLUDE}, meaning that instances marked for | ||
* removal are replaced by null in the returned list of entities when {@link OrderedReturn} | ||
* is used. | ||
* The default is {@link #EXCLUDE}. | ||
* | ||
* @see org.hibernate.MultiFindOption | ||
* @see OrderedReturn | ||
* @see org.hibernate.Session#findMultiple(Class, List, FindOption...) | ||
* @see org.hibernate.Session#findMultiple(EntityGraph, List , FindOption...) | ||
* | ||
* @since 7.2 | ||
*/ | ||
public enum IncludeRemovals implements MultiFindOption { | ||
/** | ||
* Removed entities are included in the load result. | ||
*/ | ||
INCLUDE, | ||
/** | ||
* The default. Removed entities are excluded from the load result. | ||
* <p/> | ||
* When combined with {@linkplain OrderedReturn#UNORDERED}, the entity is | ||
* simply excluded from the result. | ||
* <p/> | ||
|
||
* When combined with {@linkplain OrderedReturn#ORDERED}, the entity is replaced | ||
* by {@code null} in the result. | ||
* | ||
* @see OrderedReturn | ||
*/ | ||
EXCLUDE | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.orm.test.pc; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import org.hibernate.testing.orm.junit.DomainModel; | ||
import org.hibernate.testing.orm.junit.SessionFactory; | ||
import org.hibernate.testing.orm.junit.SessionFactoryScope; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
|
||
import static org.hibernate.LockMode.PESSIMISTIC_WRITE; | ||
import static org.hibernate.OrderedReturn.ORDERED; | ||
|
||
/** | ||
* @author Steve Ebersole | ||
*/ | ||
@SuppressWarnings("JUnitMalformedDeclaration") | ||
@DomainModel(annotatedClasses = FindMultipleDocTests.Person.class) | ||
@SessionFactory | ||
public class FindMultipleDocTests { | ||
@Test | ||
void testUsage(SessionFactoryScope factoryScope) { | ||
factoryScope.inTransaction( (session) -> { | ||
//tag::pc-find-multiple-example[] | ||
List<Person> persons = session.findMultiple( | ||
Person.class, | ||
List.of(1,2,3), | ||
PESSIMISTIC_WRITE, | ||
ORDERED | ||
); | ||
Comment on lines
+53
to
+58
Check noticeCode scanning / CodeQL Unread local variable Note test
Variable 'List persons' is never read.
|
||
//end::pc-find-multiple-example[] | ||
} ); | ||
} | ||
|
||
@Entity(name="Person") | ||
@Table(name="persons") | ||
public static class Person { | ||
@Id | ||
private Integer id; | ||
private String name; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what scope should it be applied to ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire section needs a re-write. Feel free to tackle it :)
I'm just trying to improve it by removing out dated information - addition by subtraction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I was just indicating that perhaps the 'to' was missing, that's all