I've a class Foo, which have an @Entity and @Table annotation, and an other class, Bar, which extends Foo. Are the annotations on the Bar class? If not, can I force that?
Thanks a lot! Sam.
I've a class Foo, which have an @Entity and @Table annotation, and an other class, Bar, which extends Foo. Are the annotations on the Bar class? If not, can I force that?
Thanks a lot! Sam.
Annotations are not inherited.
You can read more here: http://fusionsoft-online.com/articles-java-annotations.php
Some other references: https://stackoverflow.com/a/1644135/1001027 and https://stackoverflow.com/a/4745820/1001027
Exceptions are annotations which its declaration is annotated with @Inherited.
The @Entity
and @Table
annotations are not inherited by default, but you can use the @Inheritance
annotation on the superclass to cause them to be inherited to subclasses, though.
See here for more information: http://en.wikibooks.org/wiki/Java_Persistence/Inheritance