I'm just wondering if it is possible to somehow attach Hibernate validators to existing objects dynamically (i.e. at runtime), or if anyone has done anything similar.
I'm designing a web app which will contain a bunch of entities which will not only be unknown until runtime, but can also change at runtime. It looks feasible to create and update ORM information at runtime using the Hibernate configuration mechanism and work with Map-based named entities. The entities are going to be used in data entry and editing, so they will require field and "class" level validation. It would be very neat to be able to add validators at runtime also, so that we can take advantage of a standard way of validating entities (we have normal mapped entities also) and use existing compatible frameworks - like the Seam JSF validator tags.
So, my question to everyone is - has anyone done something similar, and how did you solve this problem? ...and to the Validator experts - can you see a way of doing this neatly with the existing Validator version?
|