Reputation: 582
Is there possibility to add new column in subclass of entity? Something like:
Base class:
@Entity
@Table(name = "users")
public class User {
@Column
private String login;
}
Subclass:
@Entity
@Table(name = "users")
public class UserWithField extends User {
@Column
private String field;
}
I don't want to change base class (User) at all. Would it work somehow?
Upvotes: 1
Views: 723
Reputation: 4309
Just create new class for new entity. Generally,In hibernate inheritance is used when you have two or more related tables.
Upvotes: 1