[jboss-user] [EJB 3.0] - Can't find EJB Annotations

ThomasGo do-not-reply at jboss.com
Tue Nov 21 05:18:40 EST 2006


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987511#3987511

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987511



More information about the jboss-user mailing list