After migration from 4.2.x to 5.2.9 batching susbsystem (@vladmihalcea) stops working we got
{noformat} 08:46:59,871 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-53) ERROR: duplicate key value violates unique constraint "pk_purchase_document" Details: Key (id_purchase_document)=(266985) already exists. {noformat}
Its very diffcult to add test Test case because error occurs in cross module functionality which is huge but in https://github.com/MirekSz/hibernate-HHH-11634 In screenshots you can see what is wrong. In action queue there are 3 elements with the same id (hash = 5167) which generates after all inserting 3 times elements with the same id (with hibernate.order_inserts false it works)
Config: hibernate.order_inserts true hibernate.jdbc.batch_size 10
I also try SNAPSHOT VER after HHH-11585 but the same error occurs
In our model we use mappings relations like this
{code:java} class PurchaseDocumentBalance { @JoinColumn(name = "ID_PURCHASE_DOCUMENT", nullable=false) @ManyToOne(fetch = FetchType.LAZY) private PurchaseDocument purchaseDocument; }
class PurchaseDocument { @JoinColumn(name = "ID_PURCHASE_DOCUMENT", updatable = false) @OneToMany(fetch = FetchType.LAZY, cascade=CascadeType.REMOVE, orphanRemoval=true) private Set<PurchaseDocumentBalance> purchaseDocumentBalanceOneSet = new HashSet(); } {code} |
|