views:

174

answers:

1

I have an abstract superclass that has JPA annotations on it mapping some of its fields. The class itself has the @MappedSuperclass annotation.

Can I specialize/add or change just one element of an inherited annotation without re-specifying the entire annotation?

+1  A: 

The only thing you can do with Annotations is to place an Annotation on an Annotation and have a library which understands this as a form of inheritance.

The problem is that if you re-specify the entire annotation, any library which expects MappedSuperclass will ignore it.

Peter Lawrey
Too bad for me. This means I am going to have to create a almost a dozen subclasses for no other reason than to tweak annotations. What's worse, most of the annotations are the same for all subclasses! I hate duplicate annotations even more than duplicate code.
HDave