-->
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: Verify if Double is empty
PostPosted: Thu Feb 21, 2013 4:56 pm 
Newbie

Joined: Thu Feb 21, 2013 4:54 pm
Posts: 2
I'm developing a web application and want to validate a Double.
Code:
@Min(0)
@Column(nullable=false)
private Double preco;


Someone can help me?


Top
 Profile  
 
 Post subject: Re: Verify if Double is empty
PostPosted: Fri Feb 22, 2013 5:53 am 
Beginner
Beginner

Joined: Wed Feb 06, 2013 2:43 am
Posts: 46
you can verify it in the getter


private Double preco;

@Column(nullable=false)
public Double getPreco () {
if(preco < 0) {
return 0 ;
} else {
return title ;
}

}

_________________
Thanks,
Ajit Singh
ajits@mindfiresolutions.com
www.mindfiresolutions.com


Top
 Profile  
 
 Post subject: Re: Verify if Double is empty
PostPosted: Fri Feb 22, 2013 1:33 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi,

What exactly do you mean by "if Double is empty"? Is this to say that your value may not be null? If so, you can use the @NotNull constraint. You may also consider to use a primitive double instead of the wrapper type Double.

--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.  [ 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.