-->
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.  [ 1 post ] 
Author Message
 Post subject: String variable with Range annotation
PostPosted: Wed Feb 24, 2010 2:57 pm 
Newbie

Joined: Fri Oct 30, 2009 4:30 pm
Posts: 16
Hi I have a String variable
It is nullable=true in the database.
I have defined it as follows :


@Column(name = "MINI_NO", length = 1)
@Range(min = 1, max = 6, message = "miniNo out of Range")
public String getMiniNo() {
return this.miniNo;
}

public void setMiniNo(String miniNo) {
this.miniNo = miniNo;
}

The thing is when I am updating this variable in a form in my application, I observe the following behavior:

When I don't enter any value and submit the form I get Validation failed from hibernate. What I am trying to understand is that since this variable is nullable in the database and String datatype. Why is it not accepting no value being entered.

I mean it accepts the values from 1 to 6 and any other number out of the range will display the message "miniNo out of Range" but it does not accept if no value is being entered in the field. Isn't it nullable, it should accept it, I would think.

Any thoughts and suggestion please.

thanks
Sai


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.