私は PostgreSQL でテーブル継承を使用し、テーブルビジネスはusersを拡張します。
@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
}
テーブルbusinessには、ユーザーが持っていない列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 だけの問題ですか?