-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to get ConstraintViolation in a MessageInterpolator
PostPosted: Fri Feb 24, 2012 1:21 am 
Newbie

Joined: Fri Feb 24, 2012 1:06 am
Posts: 1
Is there a way to get javax.validation.ConstraintViolation in message Interpolator?
The object we have access in the method "interpolate()" is MessageInterpolator.Context.

In my project I have a MessageInterpolator and I want to get the Class and the attibute validated.
For a example:

I have a class "Person" with the attribute "name". In interpolator I need to know the class Person and the field name.

With ConstraintViolation I could have constrantViolation.getRootBean() (Person.class) and constrantViolation.getPropertyPath() (name)


Top
 Profile  
 
 Post subject: Re: How to get ConstraintViolation in a MessageInterpolator
PostPosted: Tue Feb 28, 2012 6:00 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
The short answer is no. ConstraintViolation is created after the message is rendered.

Effectively you are asking for https://hibernate.onjira.com/browse/HV-514 and https://hibernate.onjira.com/browse/BVAL-237.
This might come in Bean Validation 1.1

--Hardy


Top
 Profile  
 
 Post subject: Re: How to get ConstraintViolation in a MessageInterpolator
PostPosted: Tue Feb 28, 2012 6:06 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Btw, could you not use custom error messages defined at the property level? This way you can incorporate the name of the field there.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.