Panache Reactive Batch Insert #29263
Replies: 3 comments 8 replies
-
/cc @FroMage, @loicmathieu |
Beta Was this translation helpful? Give feedback.
-
I think I found a lead, and here is some pseudo code to explain exactly where the issue is getting introduced. I can't reason it as to what might be happening though
It is when I try to getCollectionOfTenantBs for getting the newly inserted Bs with Ids, I get the error If I don't get the collection of tenant Bs inserted, As and Bs get inserted without any error. But I need to get the collection of tenant Bs with Ids, to map the subsequent entities C for the tenant. This is remotely a good explanation of the situation, but wanted to share some more detail, if anyone knows what might be happening. |
Beta Was this translation helpful? Give feedback.
-
Any chance you can create a small project that we can run? I can't see anything wrong in what you are showing us. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello community members, I am implementing an app in Quarkus using panache reactive, and have been running into an issue, that I have exhausted all my knowledge to determine what might be going wrong. I am not able to share any code to give the details, but I will try to explain the situation, and see if anyone can offer any hint on what might be going wrong to help me further troubleshoot this.
I have three tables A, B, C. A is the parent table for B, and B is the parent for C. When an API call is made, I select entries from A (about 90 of them), and create in A a tenant specific instance of these entries using a batch insert, and chain an insertion into table B (about 700 entries) by selecting all child records of the previously selected entries from A, and create tenant specific entries in B using a batch insert, and finally for each entry in B, create all child C records using another batch insert.
I know the limitation of batch insert in reactive, that the batch insert does not return the newly created IDs, so I run a select from each of the tables to get the IDs for the newly persisted entries so that those IDs are available for insertion into foreign key columns in child tables.
What I am running into is, it appears that insertions into table A are successful, but the insertions in to table B starts to fail (as a result I never get to table C) with the following error. Any help is greatly appreciated.
ERROR [io.qua.mut.run.MutinyInfrastructure] (vert.x-eventloop-thread-3) Mutiny had to drop the following exception: io.vertx.pgclient.PgException: ERROR: insert or update on table "B" violates foreign key constraint "B_x_A_fkey" (23503)
Before this specific error, there are a whole bunch of errors like the below. If I correlate both errors it appears that the parent ID seems to be not getting generated, and "replaceDelayedEntityIdentityInsertKeys" is running into some Null Pointer Error and hance the above error.
Beta Was this translation helpful? Give feedback.
All reactions