JPA实体继承与继承的PostgreSQL表

时间:2013-10-16 23:34:26

标签: java-ee jpa ejb

我在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 并且只接受用户表值。怎么解决这个问题吧?它不会起作用,或者它只是IDEA的问题吗?

0 个答案:

没有答案