Connection connection = new get Connection(); Statement statement = connection.create Statement(); for (Employee employee: employees) statement.execute Batch(); statement.close(); connection.close(); Note how we are creating query dynamically using data from Employee object and adding it in batch to insert in one go.
An unused Executor Service should be shut down to allow reclamation of its resources. Try running this more than one time and you may see different result as all threads are executing in parallels and who ever gets fast result, you will see result posted in Eclipse console. A simple hack would be to start a new thread, parse each order_and create an all_based on that.However, I don't want to read these files given that I already have the data in memory. At the very least you'll want to use one of the concurrent collections. For example, if you need to execute multiple operations against the list before any other thread touches it, you'll need some other sort of locking. If you know how many writing threads there are, a Count Down Latch might be a good solution for you.There is a Java program that reads a list of orders and for each order starts a thread that receives data from SQL and prints the list of items in a given order to an order_I want to write a class that would generate all_that contains a list of items and the quantity of each item in all orders.