1 Reply Latest reply on Oct 10, 2006 1:40 PM by Bill Burke

    MetaData hierarchy, a problem with annotations

    Adrian Brock Master

      I found a problem with using annotations in a hierarchy
      (or any "collection" metadata for that matter).

      Let's suppose you have an EJB annotated with
      @Resources(@Resource(name="jms/Queue", type=Queue.class mappedName="queue/SomeQueue");

      Then at the deployment level you've specified your datasource:
      @Resources(@Resource(name="jdbc/DataSoure", type=DataSource.class mappedName="java:/DefaultDS");

      Then the EJB (class level) annotation hides the deployment level annotation.

      Resources resources = MetaData.getAnnotation(Resources.class);

      What is really required is for this data to merged.

      But obviously, it is only these collection type annotations that
      should be merged to get the final result. And even then not all of them.
      e.g. a hypothetical @Descriptions annotation on the deployment
      and an ejb's resource ref should not be merged.

        • 1. Re: MetaData hierarchy, a problem with annotations
          Bill Burke Master

          This "deployment level" is a JBoss specific thing right?

          Shouldn't these types of annotations be driven by a metamodel rather than annotations? This way an annotation processor augments existing metamodel data.

          I ran into this problem as well, so what I did was process XML and annotations separately. What I should have done was combine them into one meta object model and work from there...