Save list of objects in one shot
posted 5 years ago
Depending on your database, you could do it via a stored procedure. For example, in Oracle you would need to define a database data-type for your "row" objects, plus a table-type (collection) for the list. Then you can have a PL/SQL packaged procedure that receives the list as a parameter, extracts the individual rows from this and takes care of the individual SQL INSERTs. You would need to map your input list from the Java Arraylist to the Oracle "list" type before passing it into the PL/SQL procedure.