Skip to content

Commit 79c5cbf

Browse files
committed
feat: allow to use Hibernate 7s findMultiple in Panache
1 parent 0f3c8c1 commit 79c5cbf

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ public Optional<?> findByIdOptional(Class<?> entityClass, Object id, LockModeTyp
195195
return Optional.ofNullable(findById(entityClass, id, lockModeType));
196196
}
197197

198+
public List<?> listMultiple(Class<?> entityClass, List<Object> ids) {
199+
return getSession(entityClass).findMultiple(entityClass, ids);
200+
}
201+
198202
public PanacheQueryType find(Class<?> entityClass, String query, Object... params) {
199203
return find(entityClass, query, null, params);
200204
}

extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/PanacheEntityBase.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,17 @@ public static <T extends PanacheEntityBase> Optional<T> findByIdOptional(Object
162162
throw implementationInjectionMissing();
163163
}
164164

165+
/**
166+
* Find entities of this type by their IDs.
167+
*
168+
* @param ids the IDs of the entities to find.
169+
* @return a list containing the entities found.
170+
*/
171+
@GenerateBridge
172+
public static <T extends PanacheEntityBase> List<T> listMultiple(List<Object> ids) {
173+
throw implementationInjectionMissing();
174+
}
175+
165176
/**
166177
* Find entities using a query, with optional indexed parameters.
167178
*

extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/PanacheRepositoryBase.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,17 @@ default Optional<Entity> findByIdOptional(Id id, LockModeType lockModeType) {
161161
throw INSTANCE.implementationInjectionMissing();
162162
}
163163

164+
/**
165+
* Find entities of this type by their IDs.
166+
*
167+
* @param ids the IDs of the entities to find.
168+
* @return a list containing the entities found.
169+
*/
170+
@GenerateBridge
171+
default <T extends PanacheEntityBase> List<T> listMultiple(List<Object> ids) {
172+
throw INSTANCE.implementationInjectionMissing();
173+
}
174+
164175
/**
165176
* Find entities using a query, with optional indexed parameters.
166177
*

0 commit comments

Comments
 (0)