[hibernate-dev] [OGM] OGM and Bean Validation

Gunnar Morling gunnar at hibernate.org
Wed Apr 2 10:25:28 EDT 2014


Hi,

Working on a demo for OGM, I tried to apply Bean Validation constraints to
my entities and have them automatically validated during the persistence
lifecycle.

This works as expected (which is very nice), the only thing which made me
wonder is that the resulting ConstraintViolationException is wrapped into a
RollbackException. Basically that's not surprising as we use TX demarcation
to control the flush cycle also if the store is actually non-transactional,
yet it may cause irritations and false expectations by users.

So I'm wondering whether we rather should raise a more generic
PersistenceException (or another specialized type which doesn't indicate a
rollback may happen) when using a non-transactional backend? What do you
think?

--Gunnar


More information about the hibernate-dev mailing list