# Removing an invoice with 1000 lines: cascade REMOVE vs bulk delete first
# Hibernate ORM 7.4.15.Final, H2, JDK 25
effective hibernate.jdbc.batch_size: 15

== A. em.remove(invoice) with cascade = ALL, lines never touched by the code
entities in the persistence context after find(): 1
entities in the persistence context after remove(): 1001
entities deleted (Hibernate statistics): 1001
SQL strings prepared: total=1003 select=2 delete=1001
first statements:
   sql> select i1_0.id,i1_0.number from Invoice i1_0 where i1_0.id=?
   sql> select l1_0.invoice_id,l1_0.id,l1_0.description from InvoiceLine l1_0 where l1_0.invoice_id=?
   sql> delete from InvoiceLine where id=?
   sql> delete from InvoiceLine where id=?

== A2. the same removal with hibernate.flush.queue.type=legacy (ignored by 7.x)
SQL strings prepared: total=1003 select=2 delete=1001

== B. bulk delete of the lines first, then remove(getReference(invoice))
entities in the persistence context after remove(): 1
entities deleted (Hibernate statistics): 1
SQL strings prepared: total=4 select=2 delete=2
   sql> delete from InvoiceLine il1_0 where il1_0.invoice_id=?
   sql> select i1_0.id,i1_0.number from Invoice i1_0 where i1_0.id=?
   sql> select l1_0.invoice_id,l1_0.id,l1_0.description from InvoiceLine l1_0 where l1_0.invoice_id=?
   sql> delete from Invoice where id=?
