java - Get the data from databases for each primaryKey in parallel -
i have list of primary keys ex: empids
, want employee information each emplid
database. or rather, i want data different databases based on different types of empids
using multiple threads.
currently i'm fetching first employee information , save java bean , fetch second employee , saved bean on. adding these beans arraylist
, want data databases in parallel. means @ time want employee information each employee , save bean.
basically i'm looking parallel processing rather sequentially improve performance.
i don't think you're looking parallelism in case. looking single query return employees id in collection of ids have. 1 database connection, 1 thread, 1 query, , result set.
if using hibernate, super easy hibernate criteria can use restrictions.in on employeeid , pass collection of ids. query underneath select a, b, c, ..., n employee employee_id in (1,2,3,4...,m)
if using straight jdbc, can achieve same in native query, need change resultset parsing because expect collection back.
Comments
Post a Comment