迁移polardb问题一

迁移polardb问题一

2023年7月24日发(作者:)

迁移polardb问题⼀环境polardb版本 polardb-jdbc18 1.0.0 system ${}/mybatis版本直接使⽤springboot引⼊ mybatis-spring-boot-starter 2.1.4问题描述tException: tegrityViolationException:

### The error may exist in com/xx/templatedef/dao/oracle/XXTemplateDef_### The error may involve TemplateDefByCategoryAndState-Inline### The error occurred while setting parameters### SQL: select * from act_xx_tem_def where category=? and deploy_state=1### Cause: ception: 不良的类型值 long :

ception: canot convert the column of type BYTEA to requested type long;原因mybatis查询act_tem_def表涉及到blob字段(content_bytes),默认的BlobTypeHandler的getBlob⽅法不适⽤, 需要重写handler解决⽅案1. 在业务下重写BlobTypeHandler, 获取getBinaryStream然后转换byte数组2. -> resultmap中, 加⼊下述转换3. 转换逻辑public static byte[] toByteArray(InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; int n = 0; while (-1 != (n = (buffer))) { (buffer, 0, n); } return Array();}代码springboot-polardb

发布者:admin,转转请注明出处:http://www.yc00.com/news/1690194449a312732.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信