-->
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.  [ 4 posts ] 
Author Message
 Post subject: ValidationMessages.properties where to put it in OSGI bundle
PostPosted: Sat Aug 13, 2011 11:15 am 
Newbie

Joined: Sat Aug 13, 2011 10:54 am
Posts: 3
Hi,

I created a OSGI bundle and use Hibernate validation. Created an annotation like

@Target( { TYPE })
@Retention(RUNTIME)
@Constraint(validatedBy = MyCheck.class)
@Documented

public @interface MyCheck {
String message() default "{nl.rid.domain.MyCheck}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};

and a ValidationMessages.properties file with contents like

nl.rid.domain.MyCheck="Should get this error message."

When I apply the annotation to a class it works fine except that I never get the message text from the ValidationMessage.properties file. If I add a message to the annotation like

@MyCheck (message = "another message")

then i will get the text "another message".

Where do I have to put the ValidationMessage.properties file when I am working with OSGI bundles so that the validation framework will use my ValidationMessage.properties file

regards bertin


Top
 Profile  
 
 Post subject: Re: ValidationMessages.properties where to put it in OSGI bundle
PostPosted: Sun Aug 14, 2011 3:02 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

ValidationMessages.properties should be at the root of your jar. Depending on your environment you might need a custom MessageInterpolator implementation. You need to provide more context to your exact situation for more help.

--Hardy


Top
 Profile  
 
 Post subject: Re: ValidationMessages.properties where to put it in OSGI bundle
PostPosted: Tue Aug 16, 2011 8:18 am 
Newbie

Joined: Tue Aug 16, 2011 8:15 am
Posts: 1
It seems you need to add nl.rid.domain.MyCheck.message as your key because we need add .messages at the end of every key


Top
 Profile  
 
 Post subject: Re: ValidationMessages.properties where to put it in OSGI bundle
PostPosted: Tue Aug 16, 2011 8:24 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
The key is up to you. There is no requirement to use '.message' as a suffix. It is recommended, but not enforced. {nl.rid.domain.MyCheck} should work fine as a message key.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.