Skip to content

Fix/add size validation person names#2350

Open
ThomasSchmidt1982 wants to merge 2 commits intospring-projects:mainfrom
ThomasSchmidt1982:fix/add-size-validation-person-names
Open

Fix/add size validation person names#2350
ThomasSchmidt1982 wants to merge 2 commits intospring-projects:mainfrom
ThomasSchmidt1982:fix/add-size-validation-person-names

Conversation

@ThomasSchmidt1982
Copy link
Copy Markdown

Prevent database errors when users enter names exceeding the 30-character column limit. The @SiZe annotation triggers Bean Validation before persisting, displaying a proper form error instead of an error page.

Problem: Entering a first or last name longer than 30 characters in the Owner form causes a database error page instead of a user-friendly validation message.
How to reproduce: Go to /owners/new, enter more than 30 characters in the Last Name field, submit.
Fix: Added @SiZe(max = 30) constraint on firstName and lastName in Person.java to align with the VARCHAR(30) column definition in schema.sql.
Also added (length=30) to @column to align JPA Mapping with VARCHAR(30) definition in scheme.sql

Prevent database errors when users enter names exceeding the 30-character
column limit. The @SiZe annotation triggers Bean Validation before
persisting, displaying a proper form error instead of an error page.

Signed-off-by: Thomas Schmidt <thomas.michel.schmidt@gmail.com>
Signed-off-by: Thomas Schmidt <thomas.michel.schmidt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant