-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty Iterator returned on Cursor when it is already closed #1297
Comments
@tacoo Thanks for your reporting. You should be operated a @Repository
public class ARepository {
private final AMapper aMapper;
+ @Transactional(readOnly = true)
public void whyCursorWhy() {
cursor();
resultHandler();
}
// ...
} |
Thank you for your prompt reply. It worked after adding I think it would be great if mybatis throws an error when return type Thank you |
@tacoo Thanks for your feedback. |
Add closed check at Cursor.iterator
Add closed check at Cursor.iterator
MyBatis version
mybatis-spring-boot-starter:
1.3.2
mybatis:
3.4.6
Database vendor and version
PostgreSQL:
9.6
Test case or example project
https://github.com/tacoo/mybatis-cursor
Steps to reproduce
Define a mapper method with return type
org.apache.ibatis.cursor.Cursor
https://github.com/tacoo/mybatis-cursor/blob/master/src/main/java/example/AMapper.java#L14
Also I tested a method with return type
org.apache.ibatis.session.ResultHandler
. It works as expected.Expected result
Return a cursor that has 1 record.
Actual result
Returned an empty cursor.
The text was updated successfully, but these errors were encountered: