Multiple inserts into database
The jdbc.core class PreparedStatementFactory seems to be coded to handle multiple inserts.
However, the higher level of abstraction jdbc.object package has classes that *have* to make one database trip for each insert/update. So, they have open a connection, do their thing and then close the connection for each operation. The object classes do not seem to able to leverage the multiple statements capability in the core classes.
True?
If not, can someone show me code that will post two (2) or more inserts, of DIFFERENT KINDS, into to a database before doing JDBC style clean-up (closing connections etc).
In other words, write a reusable Spring Framework based JDBC object that would implement the following back-to-back in a single database trip:
INSERT INTO PRODUCT VALUES (X, Y, Z);
INSERT INTO ORDER VALUES (A, B, C);
-- possibly more DML ---
One solution is to write a PL/SQL procedure INSERT_PROD_ORDER (A, B, C, X, Y, Z) that implements the above inserts within its body and then to use the Spring Framework stored procedure invocation instead of SQL.
But I would rather do this all in threadsafe java, if I could... :twisted: i.e. have none of my code within the database.