Fix/add size validation person names#2350
Open
ThomasSchmidt1982 wants to merge 2 commits intospring-projects:mainfrom
Open
Fix/add size validation person names#2350ThomasSchmidt1982 wants to merge 2 commits intospring-projects:mainfrom
ThomasSchmidt1982 wants to merge 2 commits intospring-projects:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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