-
I want to use a REST Reactive endpoint to create some data. I use the code below. I even just use empty entities. It will not return and no error printed. If I make the size less, it will sucessfully return. What's the problem? @Path("/record/generateDataset/{recordId36}")
@POST
@WithTransaction
public Uni<LiveResponse> generateDataset(JsonObject subtitle, String recordId36) {
Uni<?> uni = Uni.createFrom().voidItem();
Dataset dataset = new Dataset();
uni = uni.chain(v -> dataset.persist());
for (int i = 0; i < 3000; i++) {
DatasetItem datasetItem = new DatasetItem();
datasetItem.dataset = dataset;
uni = uni.chain(v -> datasetItem.persist());
}
return uni.chain(e -> {
System.out.println("haha");
return Uni.createFrom().item(new LiveResponse(LiveResponse.CODE_OK, "ok"));
}).onFailure().invoke(e->e.printStackTrace());
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
/cc @DavideD (hibernate-reactive), @FroMage (resteasy-reactive), @Sanne (hibernate-reactive), @gavinking (hibernate-reactive), @geoand (resteasy-reactive), @stuartwdouglas (resteasy-reactive) |
Beta Was this translation helpful? Give feedback.
-
I found out the problem. I can use Uni.combine instead to solve the problem. |
Beta Was this translation helpful? Give feedback.
👍 Yes, that should be safe because it's using
org.hibernate.reactive.mutiny.Mutiny.Session.persistAll(Object...)
under the hood.