Skip to content

mybatis 返回结果映射错误 #3670

Description

@xufeng888

About the Bug...

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of MyBatis.

  • I have confirmed this bug reproduces without 3rd party extensions (e.g. mybatis-plus).

Database Version

Microsoft SQL Server 2016 (RTM) - 13.0.1601.5 (X64)

JDBC Driver Version

com.microsoft.sqlserver/12.4.2.jre11

Issue Description

SELECT TOP 1 CAST(J06A029 AS VARBINARY(MAX)) as imageData FROM J06A WHERE J06A001 = '123456'
byte[] selectImageDataByReceiptNo(String receiptNo);
java 开发中:用byte[]接收 报错:
'imageData' from result set. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 不支持从 varbinary 到 TINYINT 的转换

@select("SELECT TOP 1 CAST(J06A029 AS VARBINARY(MAX)) as imageData FROM J06A WHERE J06A001 = #{receiptNo}")
Object selectImageDataByReceiptNo(String receiptNo);
用 Object 接收 程序正常

About your report...

  • I did not use images 🖼️ for showing text information (code, error, etc.).

  • I checked the Preview and my report looks awesome! 👍

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions