TableField annotation will not work

来源:2-4 实现加载图书分类功能

小白0719

2023-01-28 11:04:25

老师好,在启动tomcat 有如下报警,有影响吗?

[WARN This "categoryId" is the table primary key by @TableId annotation in Class: "com.imooc.myreader.entity.Category",So @TableField annotation will not work! RMI TCP Connection(3)-127.0.0.1] 10:54:50  c.b.m.c.m.TableInfoHelper - 

package com.imooc.myreader.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

@TableName("category")
public class Category {
    @TableId(type = IdType.AUTO)
    @TableField("category_id")
    private Long categoryId;
    @TableField("category_name")
    private String categoryName;

    @Override
    public String toString() {
        return "Category{" +
                "categoryId=" + categoryId +
                ", categoryName='" + categoryName + '\'' +
                '}';
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
}


写回答

1回答

好帮手慕小蓝

2023-01-28

同学你好,这里的警告对程序运行是没有影响的,可以忽略。

祝学习愉快~

0

0 学习 · 9886 问题

查看课程