-->
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.  [ 2 posts ] 
Author Message
 Post subject: hql cast in formula
PostPosted: Tue May 12, 2009 11:26 am 
Newbie

Joined: Tue May 12, 2009 5:54 am
Posts: 9
Code:
<property name="Chemin" type="String" formula="(case when (NIVEAU_PARENT_FK IS null) then
               ID
               else
              (case when ((select __NIVEAU.NIVEAU_PARENT_FK from NIVEAU as __NIVEAU where __NIVEAU.id=NIVEAU_PARENT_FK) is null)
                    then (ID + '-' + NIVEAU_PARENT_FK)
                    else (select (ID + '-' +  NIVEAU_PARENT_FK + '-' + __NIVEAU.NIVEAU_PARENT_FK) from NIVEAU as __NIVEAU where __NIVEAU.id=NIVEAU_PARENT_FK) end)
               
                 end)" />

i've problem, beacause (ID + '-' + NIVEAU_PARENT_FK) result 3 and not "1-2". Why ? I try to convert but ....
I've tried Cast(ID as VARCHAR) but i've a error
Why ??

select cast(ID as ????


Top
 Profile  
 
 Post subject: Re: hql cast in formula
PostPosted: Wed May 27, 2009 9:39 am 
Newbie

Joined: Wed May 27, 2009 9:37 am
Posts: 1
Try cast(ID as string).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.