omnifaces / omnipersistence

Utilities for JPA, JDBC and DataSources
Other
31 stars 12 forks source link

Feature Request: ConstraintViolation Logs #8

Closed mydeadlyvenoms closed 6 years ago

mydeadlyvenoms commented 6 years ago

It would be nice to have an option to log details about a ConstraintViolation. I guess there are different ways to solve it, before using OmniPersistence I did something like the following (first answer) inside an AbstractFacade - so the BaseEntityService might be the right place to solve it. https://stackoverflow.com/questions/12823000/bean-validation-constraints-violated-while-executing-automatic-bean-validation

BalusC commented 6 years ago

It's now always logged in BaseEntityService#persist(). It's optionally also logged in BaseEntityService#update() but only when persistence.xml has explicitly enabled bean validation as below instead of relying on default value of AUTO.

<property name="javax.persistence.validation.mode" value="CALLBACK" />
mydeadlyvenoms commented 6 years ago

Very clean solution! Great idea to make it optional for updates via persistence.xml property.

mydeadlyvenoms commented 6 years ago

Do you plan to merge the develop branch back into master to update the *-SNAPSHOT version of OmniPersistence? Or are there any blockers?

BalusC commented 6 years ago

Snapshots are already automatically published to sonatype on every commit from development branch https://oss.sonatype.org/content/repositories/snapshots/org/omnifaces/omnipersistence/0.5-SNAPSHOT/

The master branch is only for release versions.

mydeadlyvenoms commented 6 years ago

Ohww, sorry I missed the version bump.