Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4092150
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:27:19+00:00 2026-05-20T19:27:19+00:00

Here is what i want to be able to do with bean validation in

  • 0

Here is what i want to be able to do with bean validation in my JPA entities :

  1. Instead of @NotNull, i would like to do @NotNull(message="keyInMyResourceBundleFile")
  2. I would like also to parameterize the resourceBundle, and i dont know the syntax for it, because it seems to me the message attribute contains only a string.
  3. The parameter itself could be i18n-ed. For example, assuming there’s a param attribute for the resourcebundle parameters, in English, @NotNull(message="missing.value", params={"credit card"}) String creditCard; It will be displayed something like this : “Missing required value for field credit card. In Indonesia, it’ll be something like “Nilai harus di isi untuk Kartu Kredit. In this example, i cant hardcode the “credit card” because in Indonesia, it’s “Kartu Kredit”
  4. Displays the error message defined in the resource bundle on the log file or UI. Im not sure the way on how to do it, should i catch the ConstraintViolationException, get the message, and process the resource bundle by my own code ?

Please share your thoughts on this ?

Thank you !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:27:20+00:00Added an answer on May 20, 2026 at 7:27 pm

    Regarding 1 + 2

    @NotNull(message="{keyInMyResourceBundleFile}")
    

    Curly brackets are the indicator of a parameter substitution

    Regarding 3

    No idea what you are after. There is no params attribute for @NotNull. I guess you would do

    @NotNull(message="{missing.credit.card}")

    And of if you place it on another property you would call the key {missing.name}

    Regarding 4

    The ConstraintViolationException contains the set of *ConstraintViolation*s. Each ConstraintViolation contains the interpolated message as well as the message template. If you want to log it, do it …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to do this. MyInterface interface = new ServiceProxyHelper<ProxyType>(); Here's
Here's what I'd like to do: I want to create a library project that
I've managed to find the Regex to get almost the result I want here
I want to implement the solution using the pre-processor described here: Reuse define statement
Here's a simple (hopefully) L10N question: Do all locales want this format: Sunday, Nov
Here's the scenario: I have a set of buttons that I want to bind
Ok here's what I'm trying to do I want to write a class that
I want to model messages between users, here is the requirement: User has received
Here's my requirement: 1. I want my installable to have a custom license agreement
Here is the idea: When the user wants to see /controller/action, then I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.