[jboss-user] [EJB 3.0] - Re: Confused EJB3 Beginner - Ignored EJB3 Annotations

skidvd do-not-reply at jboss.com
Wed Jan 2 08:53:29 EST 2008


Aha!  It turns out that my Annotations are not being ignored - I just did not understand that I can (apparently) not mix both field and method level Annotations.

My class has several read-only attributes (i.e. there is no associated set methods).  In general, I would prefer to put my Annotations on the method level for code clarity sake.  However, when doing this for the read-only attributes, I got an error complaining that a setter could not be found.  This error message went away when I moved those Annotations to the field.  Apparently though, this had the undersired effect of making all attributes 'field' access and effectively ignored all of my other method-based Annotations for columne name, length, etc.

So, my questions now are:

1. Is there an EJB3 standard way of mixing both field and method access types?  I would like to have my default for method, but be able to override in exception cases such as the read-only attribute discussed above.

2. Is there a better way to handle read-only attributes that do NOT have an associated setter?

TIA!


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

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



More information about the jboss-user mailing list