-->
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: Can I have a ">= in a check SQL expression?
PostPosted: Tue Jan 10, 2012 7:05 am 
Newbie

Joined: Tue Jan 10, 2012 6:47 am
Posts: 4
Hello,

It's the first time I'm using Hibernate, and I'm enjoying using it, everything was working at the moment. Now I'm trying to define check constraints.

I'm writing my column check constraint like this:
<column name="avaluacio" check="avaluacio >= 0 AND avaluacio <= 10" />

But when I run my app and the mappings are ridden I get this error:
"The value of attribute "check" associated with an element type "null" must not contain the '<' character."

But I really need the '<' character to express "less than" in my sql expression.

It think maybe I have to define the sql expression in another tag and call it from the ckeck tag but i don't know how to do it. And I don't find out how to do it in the Internet.

Enlight me, please.

Thank you.


Top
 Profile  
 
 Post subject: Re: Can I have a ">= in a check SQL expression?
PostPosted: Tue Jan 10, 2012 7:42 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Since the configuration file is an XML file you can't have values containing < or >. You'll need to use the escape sequence: &lt; or &gt;


Top
 Profile  
 
 Post subject: Re: Can I have a ">= in a check SQL expression?
PostPosted: Tue Jan 10, 2012 7:50 am 
Newbie

Joined: Tue Jan 10, 2012 6:47 am
Posts: 4
Thank you.


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.