-->
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: Hibernate Entity Validation using hibernate validator jar
PostPosted: Wed Jan 09, 2013 11:01 pm 
Newbie

Joined: Wed Jan 09, 2013 10:43 pm
Posts: 2
Hi Can any one help me for Hibernate entity validation sample.
I have tried using Hibernate Validator 4.2.0 Final Jar
Below is my Entity Class

@Entity
public class Account implements Serializable, DynaUIEntityDisplayable{


@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;


@NotEmpty
@Length(min=2,max=8)
private String name;

@NotEmpty
private String displayName;

//Getters and Setters
}


When am saving the This Entity With name min Valve "a" that time it is saving in data base but am expecting ConstrainyViolationException

Can any one help me regarding this .

Thanks in Advance,

Regards,
Srikanth


Top
 Profile  
 
 Post subject: Re: Hibernate Entity Validation using hibernate validator jar
PostPosted: Fri Jan 11, 2013 5:42 am 
Hibernate Team
Hibernate Team

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

if you are using life cycle based validation there should indeed be a constraint violation. See also http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#d0e3096

Are you using JPA or native Hibernate Session? How do you persist/save the entities?

To get a better feedback you would need to provide some more context on how you use Hibernate and Hibernate Validator, preferably with some code examples.

--Hardy


Top
 Profile  
 
 Post subject: Re: Hibernate Entity Validation using hibernate validator jar
PostPosted: Fri Jan 11, 2013 8:06 am 
Newbie

Joined: Wed Jan 09, 2013 10:43 pm
Posts: 2
Hi ,
Thanks for your reply, we are using hibernate session.


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