-->
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.  [ 2 posts ] 
Author Message
 Post subject: Multiple ScriptAssert annotations
PostPosted: Fri Sep 09, 2011 7:04 pm 
Newbie

Joined: Fri Sep 09, 2011 7:01 pm
Posts: 1
I have a requirement of putting multiple validations across fields in the pojo. e.g.

1. start < expires
2. if CalculationType = Commission then rangeDisplay = Percent
etc

I cannot put multiple ScriptAssertAnnotations on the class, what's the best way to go about it?


Top
 Profile  
 
 Post subject: Re: Multiple ScriptAssert annotations
PostPosted: Sun Sep 11, 2011 5:32 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
You can define several @ScriptAssert constraints at one type using the inner @List annotation:

Code:
@List({
  @ScriptAssert(...),
  @ScriptAssert(...)
})
public class MyClass {

}


Of course you might also specify a boolean expression with all you validations within one @ScriptAssert constraint.

Hth,

Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


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