A
A
Anton Ivanov2020-01-31 11:21:04
Java
Anton Ivanov, 2020-01-31 11:21:04

When to check entity uniqueness in java?

Hello.

When in java to check the uniqueness of an entity (custom ConstraintValidator)?
At the time of receiving the DTO from the form (when it checks for completeness and pattern matching for all fields) or when the model is saved?

If you check when saving the model, then you have to catch the TransactionSystemException and get through the wilds to which field was non-unique.

Or am I doing it all wrong? :)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question