diff --git a/hibernate-core/src/main/java/org/hibernate/Session.java b/hibernate-core/src/main/java/org/hibernate/Session.java index e86de4198f..3dd61212d8 100644 --- a/hibernate-core/src/main/java/org/hibernate/Session.java +++ b/hibernate-core/src/main/java/org/hibernate/Session.java @@ -697,8 +697,8 @@ public interface Session extends SharedSessionContract, EntityManager { * matching a given identifier. If an instance is already associated with the session, that * instance is returned. This method never returns an uninitialized instance. *

- * Every object returned by {@code findAll()} is either an unproxied instance of the given - * entity class, or a fully-fetched proxy object. + * Every object returned by {@code findMultiple()} is either an unproxied instance of the + * given entity class, or a fully-fetched proxy object. *

* For more advanced cases, use {@link #byMultipleIds(Class)}, which returns an instance of * {@link MultiIdentifierLoadAccess}. @@ -711,7 +711,7 @@ public interface Session extends SharedSessionContract, EntityManager { * @see #byMultipleIds(Class) * @since 7.0 */ - List findAll(Class entityType, List ids, FindOption... options); + List findMultiple(Class entityType, List ids, FindOption... options); /** * Return the persistent instance of the given entity class with the given identifier, @@ -922,7 +922,7 @@ public interface Session extends SharedSessionContract, EntityManager { * * @throws HibernateException If the given class does not resolve as a mapped entity * - * @see #findAll(Class, List, FindOption...) + * @see #findMultiple(Class, List, FindOption...) */ MultiIdentifierLoadAccess byMultipleIds(Class entityClass); diff --git a/hibernate-core/src/main/java/org/hibernate/StatelessSession.java b/hibernate-core/src/main/java/org/hibernate/StatelessSession.java index 563bd1f8e9..c36019afe6 100644 --- a/hibernate-core/src/main/java/org/hibernate/StatelessSession.java +++ b/hibernate-core/src/main/java/org/hibernate/StatelessSession.java @@ -263,7 +263,7 @@ public interface StatelessSession extends SharedSessionContract { * null elements representing missing entities * @since 7.0 */ - List getAll(Class entityClass, List ids); + List getMultiple(Class entityClass, List ids); /** * Refresh the entity instance state from the database. diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java index a2929c3706..df9fef34ef 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java @@ -952,8 +952,8 @@ public class SessionDelegatorBaseImpl implements SessionImplementor { } @Override - public List findAll(Class entityType, List ids, FindOption... options) { - return delegate.findAll( entityType, ids, options ); + public List findMultiple(Class entityType, List ids, FindOption... options) { + return delegate.findMultiple( entityType, ids, options ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java index 473eea1ebb..7f5d4334bf 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java @@ -262,8 +262,8 @@ public class SessionLazyDelegator implements Session { } @Override - public List findAll(Class entityType, List ids, FindOption... options) { - return this.lazySession.get().findAll( entityType, ids, options ); + public List findMultiple(Class entityType, List ids, FindOption... options) { + return this.lazySession.get().findMultiple( entityType, ids, options ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index d49b75512a..23aa2d869a 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -988,7 +988,7 @@ public class SessionImpl } @Override - public List findAll(Class entityType, List ids, FindOption... options) { + public List findMultiple(Class entityType, List ids, FindOption... options) { return multiloadAccessWithOptions( entityType, options ).multiLoad( ids ); } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java index cee1850231..8fea386caf 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java @@ -511,7 +511,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen } @Override - public List getAll(Class entityClass, List ids) { + public List getMultiple(Class entityClass, List ids) { for (Object id : ids) { if ( id == null ) { throw new IllegalArgumentException("Null id"); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindAllFetchProfileTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindMultipleFetchProfileTest.java similarity index 87% rename from hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindAllFetchProfileTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindMultipleFetchProfileTest.java index 2b892e6a16..0d2570225a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindAllFetchProfileTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindMultipleFetchProfileTest.java @@ -25,8 +25,8 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @SessionFactory -@DomainModel(annotatedClasses = {FindAllFetchProfileTest.Record.class, FindAllFetchProfileTest.Owner.class}) -public class FindAllFetchProfileTest { +@DomainModel(annotatedClasses = {FindMultipleFetchProfileTest.Record.class, FindMultipleFetchProfileTest.Owner.class}) +public class FindMultipleFetchProfileTest { @Test void test(SessionFactoryScope scope) { scope.inTransaction(s-> { Owner gavin = new Owner("gavin"); @@ -35,7 +35,7 @@ public class FindAllFetchProfileTest { s.persist(new Record(456L,gavin,"hello mars")); }); scope.inTransaction(s-> { - List all = s.findAll(Record.class, List.of(456L, 123L, 2L)); + List all = s.findMultiple(Record.class, List.of(456L, 123L, 2L)); assertEquals("hello mars",all.get(0).message); assertEquals("hello earth",all.get(1).message); assertNull(all.get(2)); @@ -43,7 +43,7 @@ public class FindAllFetchProfileTest { assertFalse(Hibernate.isInitialized(all.get(1).owner)); }); scope.inTransaction(s-> { - List all = s.findAll(Record.class, List.of(456L, 123L), + List all = s.findMultiple(Record.class, List.of(456L, 123L), new EnabledFetchProfile("withOwner")); assertEquals("hello mars",all.get(0).message); assertEquals("hello earth",all.get(1).message); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindAllTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindMutipleTest.java similarity index 83% rename from hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindAllTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindMutipleTest.java index c10e69448b..dde1ae4854 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindAllTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/FindMutipleTest.java @@ -20,21 +20,21 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; @SessionFactory -@DomainModel(annotatedClasses = FindAllTest.Record.class) -public class FindAllTest { +@DomainModel(annotatedClasses = FindMutipleTest.Record.class) +public class FindMutipleTest { @Test void test(SessionFactoryScope scope) { scope.inTransaction(s-> { s.persist(new Record(123L,"hello earth")); s.persist(new Record(456L,"hello mars")); }); scope.inTransaction(s-> { - List all = s.findAll(Record.class, List.of(456L, 123L, 2L)); + List all = s.findMultiple(Record.class, List.of(456L, 123L, 2L)); assertEquals("hello mars",all.get(0).message); assertEquals("hello earth",all.get(1).message); assertNull(all.get(2)); }); scope.inTransaction(s-> { - List all = s.findAll(Record.class, List.of(456L, 123L), READ_ONLY); + List all = s.findMultiple(Record.class, List.of(456L, 123L), READ_ONLY); assertEquals("hello mars",all.get(0).message); assertEquals("hello earth",all.get(1).message); assertTrue(s.isReadOnly(all.get(0))); @@ -42,7 +42,7 @@ public class FindAllTest { }); scope.inTransaction(s-> { Record record = s.getReference(Record.class, 456L); - List all = s.findAll(Record.class, List.of(456L, 123L)); + List all = s.findMultiple(Record.class, List.of(456L, 123L)); assertSame(record, all.get(0)); }); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/stateless/GetAllTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/stateless/GetMultipleTest.java similarity index 86% rename from hibernate-core/src/test/java/org/hibernate/orm/test/stateless/GetAllTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/stateless/GetMultipleTest.java index 6560894203..bf88d2ca47 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/stateless/GetAllTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/stateless/GetMultipleTest.java @@ -17,15 +17,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @SessionFactory -@DomainModel(annotatedClasses = GetAllTest.Record.class) -public class GetAllTest { +@DomainModel(annotatedClasses = GetMultipleTest.Record.class) +public class GetMultipleTest { @Test void test(SessionFactoryScope scope) { scope.inStatelessTransaction(s-> { s.insert(new Record(123L,"hello earth")); s.insert(new Record(456L,"hello mars")); }); scope.inStatelessTransaction(s-> { - List all = s.getAll(Record.class, List.of(456L, 123L, 2L)); + List all = s.getMultiple(Record.class, List.of(456L, 123L, 2L)); assertEquals("hello mars",all.get(0).message); assertEquals("hello earth",all.get(1).message); assertNull(all.get(2));