尝试插入数据库时​​,“字段列表”中出现错误未知列客户端

我的代码显示了主键和外键

@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ParamKey")
    private long paramKey;

    public long getParamKey() {
        return paramKey;
    }

    @Column(name = "FeedKey")
    public long getFeedKey() {
        return feedKey;
    }

    public void setFeedKey(long feedKey) {
        this.feedKey = feedKey;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "clientKey")
    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

休眠查询如下
insert
        into
            M_FeedInputParams
            (client, createdBy, createdTs, feedKey, jobInstanceKey, logicalDeleteTms, paramName, paramOper, paramValue, paramValueType, sourceInstanceKey, updatedBy, updatedTs)
        values
            (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

客户端应该是clientKey我该怎么办?

最佳答案

尝试将您的getter和setter更改为:

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "clientKey")
private Client clientKey;

//Getter & Setter
public Client getClientKey() {
    return clientKey;
}

public void setClientKey(Client client) {
    this.clientKey = client;
}

09-27 16:53