I need to do some validation after an entity has its properties updated but before it is flushed to disk. The validation requires a select against the database. In order to make sure the entity is not saved before the validation occurs, I want to change the FlushMode to never before the validation and then back to auto right after the validation completes. This seems to work but I was wondering if there are any unintended side-effects of doing this. I guess I could evict the entity from the session and then reattach it, but it would seem the flushmode is less costly.
So, any consequences I should be aware of?
|