-->
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: Where does the date() function come from
PostPosted: Sat Jul 31, 2010 5:36 am 
Newbie

Joined: Sat Jul 31, 2010 4:58 am
Posts: 2
Hibernate version: 3.5.3-Final

DB: Firebird 2.1

Using org.hibernate.dialect.FirebirdDialect, JPA 2.0

I am having a problem with the SQL generated for one of my JPQL queries - here is an excerpt from the where clause:
Code:
date(timestamp_column)<=date_column


This obviously got generated because timestamp_column is annotated @Temporal(TemporalType.Timestamp) while date_column is @Temporal(TemporalType.Date)

The trouble is that Firebird does not understand this syntax, it should be parsed as
Code:
CAST(timestamp_column AS DATE)<=date_column


I thought it is an issue with the dialect and was trying to subclass the FirebirdDialect to override this behaviour. But I could not find any place in the dialect that would be responsible for this concrete piece of SQL. Thought even about doing some regex replacement in Dialect.transformSelectString, but it turns out it does not work as I supposed (ie. it is not called on every query sent to DB)

Does anyone have an idea where does the date() function come from and what can I tweak to get it working?

Thanks a lot
Martin Cerny


Top
 Profile  
 
 Post subject: Re: Where does the date() function come from
PostPosted: Sat Jul 31, 2010 6:00 am 
Newbie

Joined: Sat Jul 31, 2010 4:58 am
Posts: 2
Hey, I am sorry, this was completely due to my idiocy. The date function was present in the original JPQL which I had a little scrumbled and thus did not notice :-(


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.