As far as I am aware JVM's are meant to ignore unkown annotations rather than throwing ClassNotFoundException.
Thanks for replying, Stuart. The problem that still seems to exist is reusability. I would like the reusability to be present across all applications (Seam and non-Seam). If I annotate an entity bean with Seam UI validation annotations for one application, then those annotations may not be applicable to a completely different Seam application context. This forces me to duplicate the entity bean so that it can be annotated differently for a second Seam application (consider that Hibernate entity pojos can be reused and their behavior can be altered in different contexts via application-specific hibernate mapping files).
This would lead me to believe that Seam UI validation annotations (or the functionality that they provide) belong outside of the entity bean code. The annotations in the scenario I am describing prevent the entity bean from being reusable across multiple Seam applications. It may be said that the entity bean could possibly be extended and overriden, but the inheritance approach seems a little messy IMO.
I believe that if the validation is intrinsic to the entity, it can be modelled as a Seam/Hibernate validation annotation. If it is not, then indeed it belongs to another layer, eg rules.
For example consider an entity representing a person. The
agefield should be grater than zero, and this is an intrinsic rule: it doesnt make sense for age to be less than 0. However, in a loan application, the age might have the additional constraint that it is above 18 and below 65. I believe the latter constraint belongs to the rules of the specific application, not the entity.