Describe the solution you'd like
I would like JPAStreamer to be able to work with Hibernate Reactive, to perform non-blocking operations.
Describe alternatives you've considered
N/A
Additional context
Currently using Quarkus with Hibernate Reactive. I have repository as below, however, the operation itself is blocking.
@ApplicationScoped
@AllArgsConstructor
public class ComponentTypeRepository implements PanacheRepository<ComponentType> {
private EntityManager entityManager;
private final EntityReferenceDecoder entityReferenceDecoder;
public Uni<List<ComponentType>> byIdSet(Set<EntityReference> entityReferenceSet) {
return Uni.createFrom().item(getJPAStreamer().stream(ComponentType.class)
.filter(ComponentType$.id.in(entityReferenceSet.stream().map(entityReferenceDecoder::getEntityIdFromReference).collect(Collectors.toSet())))
.collect(Collectors.toList()));
}
protected JPAStreamer getJPAStreamer() {
return JPAStreamer.createJPAStreamerBuilder(() -> entityManager).build();
}
}
This code produces an exception:
SRGQL012000: Data Fetching Error: io.quarkus.runtime.BlockingOperationNotAllowedException: You have attempted to perform a blocking operation on a IO thread. This is not allowed, as blocking the IO thread will cause major performance issues with your application. If you want to perform blocking EntityManager operations make sure you are doing it from a worker thread.
at io.quarkus.hibernate.orm.runtime.session.TransactionScopedSession.checkBlocking(TransactionScopedSession.java:116)
at io.quarkus.hibernate.orm.runtime.session.TransactionScopedSession.getCriteriaBuilder(TransactionScopedSession.java:537)
at org.hibernate.engine.spi.SessionLazyDelegator.getCriteriaBuilder(SessionLazyDelegator.java:699)
at org.hibernate.engine.spi.SessionLazyDelegator.getCriteriaBuilder(SessionLazyDelegator.java:67)
at org.hibernate.Session_OpdLahisOZ9nWRPXMsEFQmQU03A_Synthetic_ClientProxy.getCriteriaBuilder(Unknown Source)
at com.speedment.jpastreamer.criteria.CriteriaFactory.createCriteria(CriteriaFactory.java:82)
at com.speedment.jpastreamer.criteria.CriteriaFactory.createCriteria(CriteriaFactory.java:59)
at com.speedment.jpastreamer.criteria.standard.StandardCriteriaFactory.createCriteria(StandardCriteriaFactory.java:44)
at com.speedment.jpastreamer.renderer.standard.internal.StandardRenderer.render(StandardRenderer.java:99)
at com.speedment.jpastreamer.builder.standard.internal.BaseStreamBuilder.renderResult(BaseStreamBuilder.java:183)
at com.speedment.jpastreamer.builder.standard.internal.BaseStreamBuilder.renderAndThenApply(BaseStreamBuilder.java:122)
at com.speedment.jpastreamer.builder.standard.internal.StreamBuilder.collect(StreamBuilder.java:192)
at com.speedment.jpastreamer.autoclose.standard.internal.AutoClosingStream.lambda$collect$7(AutoClosingStream.java:177)
at com.speedment.jpastreamer.autoclose.standard.internal.AbstractAutoClosingBaseStream.finallyClose(AbstractAutoClosingBaseStream.java:95)
at com.speedment.jpastreamer.autoclose.standard.internal.AutoClosingStream.collect(AutoClosingStream.java:177)
at net.shamil.dxtower.repositories.ComponentTypeRepository.byIdSet(ComponentTypeRepository.java:27)
Describe the solution you'd like I would like JPAStreamer to be able to work with Hibernate Reactive, to perform non-blocking operations.
Describe alternatives you've considered N/A
Additional context Currently using Quarkus with Hibernate Reactive. I have repository as below, however, the operation itself is blocking.
This code produces an exception: