Hi,
I'm trying to make a bean level validation mechanism and I encountered a case in which I wanted to validate a property of a bean which is in fact a collection.
The problem is that if only the collection is modified, Hibernate won't generate a pre-update event on the entity since the collection is not actually regarded as part of the state of the entity. The only event that seems to help somewhat is the session flushing event but it is rather general for this particular case.
I actually used Hibernate Validation to create a bean level validation annotation whose validator calls a method on the bean that does the actual validation. So I used the pre-update / pre-insert listeners from H Validation.
The question is: is there any event mechanism specific to collection operations that I missed and if not what do you think would be the best approach to somehow "pass" the event to the entity?
Thanks,
Alex
|