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: cast(stringvalue AS decimal)
PostPosted: Mon Jan 07, 2008 8:21 am 
Newbie

Joined: Wed Mar 22, 2006 5:43 am
Posts: 15
Location: Belgium
'stringvalue' comes from a varchar mysql column, in sql i can use things like

Code:
... where cast(extra as decimal) > 100


when it try this in HQL it gives me a nullpointer.

Code:
java.lang.NullPointerException
   at org.hibernate.dialect.function.CastFunction.render(CastFunction.java:36)
   at org.hibernate.hql.ast.SqlGenerator.endFunctionTemplate(SqlGenerator.java:127)


using Hibernate 2.3.10 and Mysql 5.0.37


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 07, 2008 2:48 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
bowa,

I never used cast(), but the documentation says that

1) cast must be supported by the underlying database (not a problem in this case)

2) the second argument has to be a Hibernate type. I believe "decimal" is not a Hibernate type.

Maybe try another type?

_________________
Gonzalo Díaz


Top
 Profile  
 
 Post subject: Re: cast(stringvalue AS decimal)
PostPosted: Tue Oct 11, 2011 1:28 am 
Newbie

Joined: Tue Oct 11, 2011 1:14 am
Posts: 1
try
Code:
cast(stringvalue as big_decimal)


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.