-->
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: How does hibernate handl sql-functions in hql-where clause?
PostPosted: Thu Aug 25, 2005 6:02 am 
Newbie

Joined: Thu Aug 25, 2005 5:43 am
Posts: 2
Hello,
despite I read http://www.hibernate.org/hib_docs/v3/re ... yhql-where
it is not clear for me how hibernate handles sql-functions in hql-where clause.
E.g. we use to_date('2004/10/10','YYYY/MM/DD'). I guess to_date() is non standard SQL at any DB.
So I want to know if I am barking up the right tree.
My clue is:
Hibernate passes sql-functions to the underlying DB without converting or translating. True or False?
How does hibernate detect sql-functions?

Thanks for help.

greets,
martin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 3:48 pm 
Beginner
Beginner

Joined: Thu Aug 18, 2005 4:34 pm
Posts: 33
I think it handles only certain ones, for others you will have to write a native SQL query.


Top
 Profile  
 
 Post subject: Re: How does hibernate handl sql-functions in hql-where clau
PostPosted: Thu Aug 25, 2005 4:13 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
pletzma wrote:
Hello,
despite I read http://www.hibernate.org/hib_docs/v3/re ... yhql-where
it is not clear for me how hibernate handles sql-functions in hql-where clause.
E.g. we use to_date('2004/10/10','YYYY/MM/DD'). I guess to_date() is non standard SQL at any DB.
So I want to know if I am barking up the right tree.
My clue is:
Hibernate passes sql-functions to the underlying DB without converting or translating. True or False?
How does hibernate detect sql-functions?

Thanks for help.

greets,
martin


For functions that aren't predefined, you can extend the Dialect you are using and register the new functions.

in your case it might be something like
Code:
registerFunction( "to_date", new SQLFunctionTemplate(Hibernate.STRING, "to_date(?1,'YYYY/MM/DD')") );

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


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.