-->
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: Using hibernate validator with Scala
PostPosted: Sun Oct 17, 2010 2:00 pm 
Newbie

Joined: Mon Mar 08, 2010 3:22 pm
Posts: 3
I'm trying to use hibernate validator with Scala. It's turned out to be more of a challenge that I expected because of scala's use of constructors. So given the scala class:

class Foo(@Size(7,0) val bar:String)

that compiles down to a java class that resembles:

class Foo {
public Foo(String bar) {...}
public String bar() {...}
}

and using reflection it would reveal that the Size annotation is on the constructor with one arg by calling constructor.getParameterAnnotations.

If I created my own validationFactory impl is there a way to validate a scala class that looks like that.

thanks,
Mike


Top
 Profile  
 
 Post subject: Re: Using hibernate validator with Scala
PostPosted: Mon Oct 18, 2010 6:30 am 
Hibernate Team
Hibernate Team

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

great to see that there are some integration attempts with Scala. Not sure how much I can help. You probably need to provide a little more context, because I don't know so much about Scala.

That said, it seems that you maybe need method/parameter level validation. That is currently not yet possible with Hibernate Validator and it is only a suggestion of the Bean Validation specification. We are working on method level validation under HV-347. Gunnar has a POC ready and we should have this feature ready soon.

Not sure though if this is really your problem. Is it ;-) ?

--Hardy


Top
 Profile  
 
 Post subject: Re: Using hibernate validator with Scala
PostPosted: Mon Oct 18, 2010 1:35 pm 
Newbie

Joined: Mon Mar 08, 2010 3:22 pm
Posts: 3
Hi Hardy,

Thanks for the reply, yes that sounds like what I'd need. I'll give it another try when 4.2 is out, thx again.

Mike


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.