From 63d3d32f42bc6426958401156aead9a3c592cdc9 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Fri, 18 Oct 2024 21:22:22 +0200 Subject: [PATCH] rename findAll -> findMultiple, getAll -> getMultiple --- .../src/main/java/org/hibernate/Session.java | 8 ++++---- .../src/main/java/org/hibernate/StatelessSession.java | 2 +- .../hibernate/engine/spi/SessionDelegatorBaseImpl.java | 4 ++-- .../org/hibernate/engine/spi/SessionLazyDelegator.java | 4 ++-- .../main/java/org/hibernate/internal/SessionImpl.java | 2 +- .../org/hibernate/internal/StatelessSessionImpl.java | 2 +- ...fileTest.java => FindMultipleFetchProfileTest.java} | 8 ++++---- .../{FindAllTest.java => FindMutipleTest.java} | 10 +++++----- .../{GetAllTest.java => GetMultipleTest.java} | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) rename hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/{FindAllFetchProfileTest.java => FindMultipleFetchProfileTest.java} (87%) rename hibernate-core/src/test/java/org/hibernate/orm/test/loading/multiLoad/{FindAllTest.java => FindMutipleTest.java} (83%) rename hibernate-core/src/test/java/org/hibernate/orm/test/stateless/{GetAllTest.java => GetMultipleTest.java} (86%) diff --git a/hibernate-core/src/main/java/org/hibernate/Session.java b/hibernate-core/src/main/java/org/hibernate/Session.java index e86de4198f6..3dd61212d87 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 563bd1f8e91..c36019afe6e 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 a2929c37067..df9fef34ef7 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 void detach(Object entity) { } @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 473eea1ebb8..7f5d4334bf5 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 void clear() { } @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 d49b75512aa..23aa2d869af 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 @@ else if ( option instanceof ReadOnlyMode ) { } @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 cee18502318..8fea386caf8 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 T get( } @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 2b892e6a164..0d2570225a2 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.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 c10e69448b5..dde1ae48547 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.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 65608942033..bf88d2ca47d 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.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));