1 Reply Latest reply on Nov 21, 2006 6:16 AM by Thomas Goettlich

    Can't find EJB Annotations

    Thomas Goettlich Novice

      Hi, I'm new to this forum so I don't know if this is the right place for my question, but here it is:

      I have serveral embedded classes in my entities, e.g. a field of type 'Address'(embedded class) in entity 'Person'. At Runtime I want to inspect my entities in order to be able to have one class which is able to set/get properties given by name, e.g. MetaData.set(Entity target, String field, Object value) would check if the field exists and then tries to set the value of the field in the given instance.

      My embedded classes should not be visible as such, but their properties should appear as properties of the entity. For example, 'MetaData.set(new Person(), "street", "a long street") 'should be equivalent to 'new Person().getAddress().setStreet("a long street")'.

      Now, here's the problem: When inspecting my class I want to know if a method 'getXXX()' (e.g. 'getAddress()') is annotated with @Embedded so that I can go and inspect the class Address. However, when calling Method.getAnnotations() on such a method I get a zero-size array.
      If I add a custom annotation @Test that one is returned, but @Embedded and the like (doesn't work for @Entity on classes, too) are not.

      I'd appreciate any help. Thanks in advance folks.