-->
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: Validate nested property
PostPosted: Wed Feb 08, 2012 2:33 am 
Newbie

Joined: Wed Feb 08, 2012 2:09 am
Posts: 5
How can I validate a nested property, in some contexts only?

In the snipped below, I want to validate that `foo` is @NotNull, but only in Usage1
Code:
class Used {
  String foo;
  public String getFoo() {
    return foo;
  }
}

class Usage1 {
  Used used;
  public Used getUsed() {
    return used;
  }
}

class Usage2 {
  Used used;
  public Used getUsed() {
    return used;
  }
}


Top
 Profile  
 
 Post subject: Re: Validate nested property
PostPosted: Thu Feb 09, 2012 4:52 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Sounds like this would be a usecase for https://hibernate.onjira.com/browse/BVAL-208. Obviously this is not implemented yet.
I guess in the current state you would have to use groups. You would have to use two different groups, one in Usage1 and Usage2 and in used the @NotNull on foo would be part of both groups.

--Hardy


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.