【发布时间】:2012-07-20 13:33:42
【问题描述】:
我很想深入了解 ResultSet 的工作原理。 我对 ResultSet 有很多疑问。 比如性能方面哪个更好。
while(rs.next())
{
// iterate as well as do call some other functions.
}
or
while(rs.next())
{
// iterate and store the column values in a map
}
// do functions using the map.
因为该表被许多其他并发程序访问。
【问题讨论】:
-
你的两个方案是等价的,防止并发访问使用事务。
-
第二个不适合大型结果集,可能会耗尽内存