-->
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 and/or convert unsupported...
PostPosted: Wed Oct 19, 2005 3:15 pm 
Newbie

Joined: Wed Oct 19, 2005 3:12 pm
Posts: 2
I need to cast a string value to an integer value to do basically this...

select max(cast(myStringColumn as Int32)) where ...


But this seem to be unsupported?!?
It's supported in Hibernate (according to the HQL docs there)
I've also searched through the code of the project and found no references to anything that might look like a cast operation...
It's standard ANSI 92 SQL synta!!

Please help!!

Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 4:19 pm 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
Can you create an Int32 property that converts to/from a string field in your class?

BOb


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 3:43 am 
Newbie

Joined: Wed Oct 19, 2005 3:12 pm
Posts: 2
Probably, but I don't see how that is gonna help me since I need the conversion inside a max function and therefore the result of the cast becomes the input to my call to the aggregate max function...
This needs to be implemented in hql by modyfying the Dialect.cs and/or MsSql2000Dialect.cs files...

Though the good news is I've started on it, please if someone has some suggestions for how I should do this to make it good enough to maybe become patched into the main branch I'd be very pleased...
At the moment now I've implemented it in Dialect.cs, though the problems is the aggregate doesn't take only one argument, it takes a string and a type like this: "cast(myColumn AS int)" meaning it becomes garbled...

Thomas


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.