pablo.pazos
06/06/2025, 9:41 PMorg.springframework.orm.hibernate5.HibernateSystemException: The EntityInsertAction was vetoed.; nested exception is org.hibernate.action.internal.EntityActionVetoException: The EntityInsertAction was vetoed.
That happens in Grails 5 when a domain instance is saved but an associated instance didn't validate. The weird thing is that instead of getting a Grails/GORM validation exception, we get an exception from Hibernate that doesn't help much to telling the dev what's going on.
This happens to me from time to time and I continue finding the same question again and again on SO https://stackoverflow.com/questions/73624214/entityactionvetoexception-the-entityinsertaction-was-vetoed/79656508#79656508
Wouldn't it be better that Grails/GORM catches that and re-throws a validation exception telling the dev which instance in which associations isn't valid and maybe including where that's not valid? (like null value on a nullable:false field, etc).
An alternative would be to add this to every controller, maybe adding the instance.errors.allErrors to the exception
def handleVetoed (HibernateSystemException e)
{
throw new ValidationException(e)
}