java - What is the best way to iterate over a large result set in JDBC/iBatis 3? -
we're trying iterate on large number of rows database , convert objects. behavior follows:
- result sorted sequence id, new object created when sequence id changes. object created sent external service , have wait before sending 1 (which means next set of data not used)
- we have invested code in ibatis 3 ibatis solution best approach (we've tried using rowbounds haven't seen how iteration under hood).
- we'd balance minimizing memory usage , reducing number of db trips.
- we're open pure jdbc approach we'd solution work on different databases.
update 1:
- we need make few calls db possible (1 call ideal scenario) while preventing application use memory. there other solutions out there type of problem may pure jdbc or other technology?
update 2
- query backend driven , have 1 instance executing @ given time.
thanks , hope hear insights on this.
it seems need sort of pagination. ibatis through standard limit/offset parameters in query (and rowbounds in ibatis 3 ).
but seems (if right) using group feature of ibatis, select returning n records n1 distint "idx" fields result in creation of n1 "parent" objects each 1 having several children objects (with total of n children objects created). or that.
unfortunately (and understandably) both things do not mix well.
i dont' see silver bullet here, 1 can think of many approaches, each has shortcomings - hard evaluate without more information.
if main objects "big" (many records) , each 1 processed individually (with trip remote server) might want ad-hoc pagination, object per page, remembering internally previosuly read id (something select ... ... id = (select min(id) .... id > #lastid#
) )
Comments
Post a Comment