Reputation: 633
I have a question.
Lets say I have an Entity Class called BaseEntity. I annotate this class with @Entity as follows.
@Entity
public class BaseEntity implements Serializable {
.....
}
If I write another class called Employee that extends BaseEntity as
public class Employee extends BaseEntity{
....
}
and I do not annotate it with @Entity, will my employee class have Entity like behaviour? What I mean to ask is will it become an Entity because its extending my BaseEntity
Or should I always need to annotate a class with @Entity to get Entity like behaviour?
Upvotes: 2
Views: 497
Reputation: 597402
Yes, you have to annotate it as entity. But for your base class you can use @MappedSuperclass
, so that no table is required for it
Upvotes: 4
Reputation: 15577
You have to annotate it (or mark it in orm.xml) as an Entity ... for all classes that are required to be persistable
Upvotes: 1