-->
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.  [ 1 post ] 
Author Message
 Post subject: Hib query with TeraData: compare date of type Timestamp
PostPosted: Wed Dec 26, 2012 10:47 pm 
Newbie

Joined: Wed Dec 26, 2012 9:49 pm
Posts: 1
Hello all,

Need help on the date comparison in Hibernate (using Spring).
The date (empStDate) is declared in TeraData as Timestamp(6) and in POJO class defined as Date type as Date.

Options tried [both did not work]

1) Modified annotation as @Temporal(TemporalType.TIMESTAMP) and tried to set the parameter before the query

execution.
But it would consider the java.sql.TIMESTAMP time and not allowing this type as TYPE for setParameter for hibernate query

(org.hibernate.Query).
Hence used the date type only.

2) Set as DATE (not any temporal type) and in the query used CAST as the value passed as STRING with mm/dd/yy format.
But the CAST was not even done and error thrown.

hibQuery.append(" and empStDt >= CAST('" + strDateVal + "'' AS TIMESTAMP(0) FORMAT 'DD-MMM-YYYYBHH:MI')");

strDateVal has value 11-DEC-2012 09:23

Any help would be greatly appreciated.

Regards,

satya


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.