我使用骆驼 jdbc 代替简单的 java jdbc 代码只是为了获取 10,200 条记录
Java JDBC:
Connection c = dataSource.getConnection();
Statement m = c.createStatement();
ResultSet rs = m.executeQuery(getEmployeeCall());
while(rs.next()) {
System.out.println(""+ rs.getString(1));
break;
}
结果只需 1 -2 秒。
但是当我使用 Camel JDBC 时:
.log(LoggingLevel.INFO, getEmployeeCall())
.setBody(constant(getEmployeeCall()))
.to("jdbc:masterdata")
.to("log:?level=INFO&showBody=true");
大约需要 4 分钟才能获得结果,这非常多。
知道为什么 Camel JDBC 这么慢吗?
查询看起来有点像:
SELECT e.userid, e.firstname, e.lastname, e.mobilephone, e.email, e.employmenttype, e.enddate, decode(e.llevel,'','N','Y') as Manager, e.llevel, leader.userid as leader_userid, cm.companyname as cm_companyname, CASE e.companyid WHEN '1' THEN '29' WHEN '13' THEN '435' WHEN '550' THEN '153' WHEN '640' THEN '52' WHEN '67' THEN '40' ELSE e.companyid END as companyid, e.COUNTRY, loc.LOCATIONNAME as loc_locationname, e.unitid, org.UNITNAME as org_unitname, e.resultareaid as orgstr_unitid, e.locationid, e.imageprofile FROM employee e LEFT JOIN employee leader ON e.leaderemployeeid = leader.EMPLOYEEID LEFT JOIN company cm ON (CASE WHEN e.companyid = '1' THEN '29' WHEN e.companyid = '13' THEN '435' WHEN e.companyid = '550' THEN '153' WHEN e.companyid = '60' THEN '52' WHEN e.companyid = '67' THEN '40' ELSE e.companyid END) = cm.companyid LEFT JOIN organisation org ON e.unitid = org.UNITID LEFT JOIN location loc ON e.locationid = loc.LOCATIONID WHERE (e.enddate is null or e.enddate > sysdate - 31)
有什么想法可以在骆驼 jdbc 中解决这个问题,或者我应该为此目的创建 bean 吗?