Spring JDBC support and large dataset

前端 未结 5 684
眼角桃花
眼角桃花 2020-12-14 02:56

When using one of the various JDBC template methods I am confused on how to iterate/scroll over large result sets (which won\'t fit into memory). Even without a direct expos

5条回答
  •  囚心锁ツ
    2020-12-14 03:16

    1. Create a custom stored procedure that extends StoredProcedure
    2. Create a RowCallBackHandler that can handle each row, one at a time.
    3. Declare your parameters. If you have a Result Set, declare that one first. Use the SqlReturnResultSet class and create it using your RowCallBackHandler
    4. Declare any other parameters
    5. Compile
    6. I did steps 2 through 5 in the constructor of my customer stored procedure
    7. Create a Map containing your input parameters
    8. Execute your stored procedures with the input parameters

    I would provide code, but the following article contains all of this information.

    Calling Stored Procedures with Spring JDBC Templates

提交回复
热议问题