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: convert float to date type
PostPosted: Tue Apr 15, 2008 2:57 pm 
Newbie

Joined: Tue Apr 15, 2008 2:34 pm
Posts: 1
We have a SQL server DB, there is a field in a table that store the date as the float type, but we
want to pull the data as the Date type. How can we do that?

I tried cast, convert functions, which work in SQL, but not work in HQL.
I also try to define the field as java.util/sql.Date, hoping it can be converted implicitly, but not working either.

I would greatly appreciate it if you can give me a hint.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 16, 2008 8:50 am 
Newbie

Joined: Tue Oct 09, 2007 3:09 am
Posts: 6
I think that you need to implement your custom user type which will convert Java type into SQL type and vice versa. See, documentation about "typedef" tag and org.hibernate.usertype.UserType interface.

Hope this help.


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.