0

映射器:

@SelectProvider(type = Provider.class, method = "retrieveTx")
        @Results(value = {
            @Result(property = "transactionId", column = "transaction_id", javaType = Integer.class, jdbcType = JdbcType.INTEGER),
        Cursor<TxModel> retrieveTx(String id);

DAO/存储库:

@Transactional(readOnly = true)
    public Cursor<TxModel> retrieveTx(String id) {
        return mapper.retrieveTx(id);
    }

执行:

private Result calTx() {
    Cursor txs = testDao.retrievetx(1);
}

我将@Transactional 添加到DAO,但我出错了:

"A Cursor is already closed." at org.apache.ibatis.cursor.defaults.DefaultCursor.iterator(DefaultCursor.java:100) ~[mybatis-3.5.6.jar:3.5.6] DefaultCursor.java:100

我也给操作加了@Transactional,还是不成功

@Transactional
private Result calTx() {
        Cursor txs = testDao.retrievetx(1);
    }
4

0 回答 0