I have a JPA model class, which worked as I expected it. A few weeks ago it started throwing errors and failed to persist.
javax.persistence.RollbackException:
javax.validation.ConstraintViolationException:
One or more Bean Validation constraints were
violated while executing Automatic Bean Validation
on callback event: preUpdate
I extracted the ConstraintViolation
, which stated:
must be greater or equal 0.01
This led me to the only attribute annotated with @DecimalMin
in my model:
@Column(nullable = false, precision = 36, scale = 2)
@DecimalMin("0.01")
@NonNull
private BigDecimal amount;
So far this sounds reasonable, but the strange thing is, the exception is raised always, no matter the value of amount
. I tried it with an amount
of 1.00
and still got the exception.
The only other clue I have is in the database, where 0.00
was persisted as the last value for amount
. I neither know how this was possible nor if it has to do with my problem.
Edit
The comments under this questions raised the need for me to clarify the environment. The database is deployed on the customers side, but he has no access to it. The schema is application exclusive and the credentials are encrypted. Therefore nobody, but the application should have been able to access the database.
The application itself is divided into an API module and a UI module. Both use the same core module for database access. The model is also part of the core module and used by the other two modules. The API is deployed on a server and allows strongly restricted access to only few operations. It is only used for other applications to integrate. The UI is installed at the clients machine and allows access to more features.
The amount of 0.00
in the database originated from the UI application. Since that moment any try to use the same operation via the API failed, whereas the UI application still works as expected.
All modules are versioned and build together in a single build process and I did ensure, that all versions on all clients are the same.