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 6575599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:24:24+00:00 2026-05-25T15:24:24+00:00

i am using hibernate validation annotation framework to validate my domain classes and validating

  • 0

i am using hibernate validation annotation framework to validate my domain classes
and validating my domain object with @Valid annotation as follows:

@RequestMapping(method = RequestMethod.POST)
    public String post(@Valid @ModelAttribute("person") Person person,BindingResult errors) {...}

and i was wondering if i want to make custom validation like checking if email exists in database

what i am doing right now is to have a property in the domain:

@AssertFalse(message = "{email.missmatch}")
private boolean emailExist;

and i set it in the post method:

person.setEmailExist(personDao.isEmailExist(person.getEmail()));

above was working with custom hibernate validator class i had to validate domains
and i was calling the validator after setting the property

but now with @Valid, the validator is called before setting the property

so, is there’s a solution to use @Valid with this case ?
or it won’t work, if it will not work please suggest me how to validate my domain class in this case instead of using @Valid, what to use ?

thanks in advance.

  • 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-25T15:24:25+00:00Added an answer on May 25, 2026 at 3:24 pm

    You can write yor complet own validators, so you do not need the “hack” with tbat marker property. How you can write such an custom validation is descriped in the jsr303 Bean Validation – specification. Google for it, you will also find lot of blogs with examples.

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

Sidebar

Related Questions

I'm using JPA 2.0/Hibernate validation to validate my models. I now have a situation
I have an app using Spring, JPA (Hibernate) and the Java validation framework (Hibernate
I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates
i am using hibernate validation (4.2.0 Final) with JSF 2 and Spring and here's
I'm using spring based validation in combination with hibernate validator enabled by the following
I'm using Hibernate Validator. I have a Class level annotation. It compares three properties
If have a Java class with some fields I want to validate using Hibernate
I am looking for validation framework and while I am already using NHibernate I
It seems that org.hibernate.cfg.Configuration object can be used to perform validation programmatically, by calling
I am using Hibernate validator for form validation in my web-app. I am using

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.