Ibatis queryWithRowHandler() 似乎仍然获取所有行
我正在使用 Ibatis 2.3.4 和 Mysql 5.1.37,以及 mysql-java-connector 5.1.6 和 java 1.6
我有一个查询从单个表返回很多行。为此,手册建议使用queryWithRowHandler()
。然而,当我调用这个查询时,它在内部似乎仍然获取所有行(在第一个 handleRow()
调用完成之前,内存增长得非常快。
我如何告诉 Ibatis 在时间部分获取小部分(我当然可以使用多个查询返回较小结果的列表,但在我看来,这正是 ibatis 应该为我做的事情)
编辑: 我尝试将语句的 fetchSize
设置为 100,这似乎没有任何作用,resultSetType="FORWARD_ONLY"
也是如此。 lazyLoadingEnabled
未在任何地方设置,因此应该启用。
I'm using Ibatis 2.3.4 and Mysql 5.1.37, with mysql-java-connector 5.1.6 with java 1.6
I have query that returns very many rows from a single table. In order to do this the manual suggests to use queryWithRowHandler()
. However when I call this query it internally still seems to fetch all rows (memory goes up very fast before the first handleRow()
call is done.
How can I tell Ibatis to fetch small at the time portions (I can of course use several queries returning lists of smaller results, but in my opinion this is precisely what ibatis should do for me)?
EDIT:
I've tried setting a fetchSize
of 100 for the statement, this doesn't seem to do anything, same for resultSetType="FORWARD_ONLY"
. lazyLoadingEnabled
isn't set anywhere, so should be enable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过更彻底的搜索后,我发现 关于jbdc实现的mysql手册和mysql问题数据库有一些有用的信息。这归结为需要以下内容:
JDBC 驱动程序需要一个设置来使用游标(这也可能有一些缺点)
该语句需要以下属性(具有任何有用的值 fetchSize)。
After doing more thorough search, I found that the mysql manual on the jbdc implementation and the mysql issue database had some useful information. This boils down to needing the following:
The JDBC driver needs a setting to use cursor (this might have some downsides too)
The statement needs the following properties (with any useful value fetchSize).