0

我在 PostgreSQL 中使用表继承,表业务扩展用户

@Entity
@Table(schema = "service", name = "users")
public class Users {
    @Id
    private String id;
    @Column(name = "nickname")
    private String name;
    private String password;

    public Users() {
    }

    public Users(String id, String password, String name) {
        this.id = id;
        this.password = password;
        this.name = name;
    }

    // getters and setters
}

业务具有用户没有的列short_name 。当我使用这个时:

@Entity
@Table(schema = "service", name = "business")
public class Business extends Users {
    @Column(name = "short_name")
    private String shortName;
}

IntelliJ IDEA 告诉我没有列short_name并且只接受users表值。如何正确解决这个问题?它不会起作用,还是只是IDEA的问题?

4

0 回答 0