-->
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: Hibernate Validator 4 failing on nested Hibernate Objects
PostPosted: Sun Dec 20, 2009 2:51 pm 
Newbie

Joined: Sun Dec 20, 2009 2:41 pm
Posts: 2
Hi,

it looks to me the validator is failing with the validation on nested hibernate objects. During debugging I saw the proxies of the embedded objects (some javassist proxy classes...) and the validator tries to validate the properties on the proxies instead of the proxied objects. Here's my object hierarchy...

Code:
public class Catalogue {

   @Valid
   private LocalizedDescription description_en;

   @Valid
   private LocalizedDescription description_de;

}

public class LocalizedDescription {

   @NotEmpty
   @Length(min = 5, max = 30)
   private String name;

   @NotNull
   @Length(min = 0, max = 140)
   private String description;

}


The validator complains the properties name and description are undefined although I can see them in the proxied objects as properly filled in.

Is this as intended ? Any workaround or "proper" way ? Help appreciated !

Regards Alex


Top
 Profile  
 
 Post subject: Re: Hibernate Validator 4 failing on nested Hibernate Objects
PostPosted: Sun Dec 20, 2009 7:27 pm 
Newbie

Joined: Sun Dec 20, 2009 2:41 pm
Posts: 2
I've managed to make it properly work. Instead of using field annotations I started using validation annotations for the getters which circumvents the described invalid access on the proxies. Still wondering what could be done in case annotating the getters is not an option.

Alex


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.