如何从其他类的表视图中标识列值以替换计数值?

公共类客户{

private static int count = 1;

public Customer(String x,String y) {
    super();
    this.x = new Simple-String-Property(x);
    this.y = new Simple-String-Property(y);
    this.id = new Simple-Integer-Property(count);
    count++;
    
}

我有一个抽象表,该表在应用程序启动后从数据库填充数据。所以我希望我的id列在检索数据后自动递增。所以我使用变量计数为静态,它工作正常。但是,当我将抽象数据提交到表时,即使表上的数据根据​​所填充的数据库显示不同的数字,ID列也将返回1。

iCMS 回答:如何从其他类的表视图中标识列值以替换计数值?

首先,类名中的破折号是吗?

第二,如果ID是主键,则它实际上可能是您无法更改的功能。

Change primary key (id) of a row in a table and shift the others downwards

本文链接:https://www.f2er.com/1948589.html

大家都在问