canal 实体对象id,始终为空

zpgglvta  于 3个月前  发布在  其他
关注(0)|答案(2)|浏览(88)
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

environment

  • canal version
  • mysql version

Issue Description

实现改接口 对象id获取不到,int类型不支持,换成String 就可以
``

@CanalTable(value = "test_one")
@Component
@Slf4j
public class TestOneHandler implements EntryHandler<TestOne> {


    @Override
    public void insert(TestOne testOne) {
        log.info("insert message  {}", testOne);
    }

    @Override
    public void update(TestOne before, TestOne after) {
        log.info("update message  before{}", before);
        log.info("update message  after{}", after);

    }

    @Override
    public void delete(TestOne testOne) {

        log.info("delete message  after{}", testOne);
    }
}
1szpjjfi

1szpjjfi1#

问题描述不清楚,CanalTable是你自己封装的?

sqserrrh

sqserrrh2#

创建和数据库想对应的对象,然后实现EntryHandler方法,对象的主键ID int 类型获取不到,换成String类型的就可以,这样还不清楚??? @CanalTable这个是 这个依赖自带的
<dependency> <groupId>top.javatool</groupId> <artifactId>canal-spring-boot-starter</artifactId> <version>1.2.1-RELEASE</version> </dependency>

相关问题