JDBC Batch


stephane
 

Hi,

Are there any options to deactivate foreign-key constraints, then insert/update/delete table per table using batches, and then reactivate foreign-key at the commit ?
I used a product with that feature which was working at least on mysql and oracle.

thanks
--
Stephane


Andy
 
Edited

You mean DELETE them in the datastore, do random operations, then re-CREATE them? Or do a datastore-specific disable (such as MySQL set foreign_key_checks=0). Nope.
But then its open source so anyone can contribute "features", not that I personally would be using that one you describe


stephane
 

I mean when performing modifications, do something like:
 -1 set constraints deffered => disable foreign-key, unique constraints, ...
 -2 Batch updates table per table (addBatch, ...)
    - perform all Deletes from table A if any
    - perform all Inserts into table A if any
    - perform all Updates of table A if any

    - perform all Deletes from table B if any
    - perform all Inserts into table B if any
    - perform all Updates of table B if any

    - ...
-3 commit

(Let the constraints are checked at the commit time.)

--
Stephane


Andy
 

JDO/JPA API calls are processed in the appropriate order. If a required statement is batchable then it is batched. Referential integrity is always assumed.
https://www.datanucleus.org/products/accessplatform_5_2/datastores/datastores.html#statement_batching

There is no mode to do "all table X followed by all table Y followed by all table Z". Open source ...


stephane
 

opensource development on such complex product (closely comparable to database software development) requires a big big expertise on the product design, constraints, ... which I don't have (yet) on DN.

Step by step ...
--
Stephane