Closed imhayatunnabi closed 10 months ago
Hi @imhayatunnabi, the list of built-in constraints in the specification is intentionally kept very small and broadly usable. This constraint idea is too specific for the validation spec, and I'm not sure if there are any implementations which support DB constraints. I would recommend looking into creating a custom constraint, there is a guide here: https://docs.jboss.org/hibernate/validator/8.0/reference/en-US/html_single/#validator-customconstraints
Yeah, database constraints should be handled at the database level. It's the only way to get them right, transaction-wise.
We intentionally stayed away of implementing this type of things in Jakarta Validation as it can be both suboptimal and incorrect.
please create a validation for unique value for a column in mentions table
like @UniqueColumnValue(table = ""tableName", columnName = "columnName")
in request dto