How can I use "inheritance" in Annotations? What are the advantages of using inheritance in Annotations?
+1
A:
This is a very general question, but I'd advise taking a look at the following resources:
- The documentation on how inheritance is declared via Hibernate annotations.
- This PDF file (chapter 2 of a book on Hibernate). Page 38 forwards deals with Hibernate annotations.
But the very basic answer to your question is that you should use the @Inheritance
annotation, like so:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Flight implements Serializable {
...
}
CaptainAwesomePants
2009-09-03 18:40:35
Yes because I study to learn it. I'm stranger this subject. My onion is mix. So thank you for resources.
stical
2009-09-04 08:25:19
+1
A:
I would suggest using the @Inheritance annotation over the @MappedSuperclass. We have had issues in the past with @MappedSuperclass being flexible enough for our ongoing maintenance needs.
mattsidesinger
2009-09-04 13:07:43