Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: HQL ifnull() in select clause / ifnull() for MySQL
PostPosted: Wed Mar 28, 2007 3:15 am 
Newbie

Joined: Thu Mar 15, 2007 2:25 am
Posts: 6
Three issues:

1) The MySQL Dialect with my version of hibernate (3.2) doesnt seem to declare some of the MySQL control flow functions (IFNULL, NULLIF etc...). Am I missing something?

2) HQL doesn't seem to support these kind of functions or something similar in the SELECT clause. I am trying to do something like:

Code:
SELECT ifnull(i.price.price,0.0) as avgPrice
from Item i...

or even
Code:
SELECT {fn ifnull(i.price.price,0.0)} as avgPrice
from Item i...


3) HQL doesn't seem to support function chaining/nesting in the select clause, somehting like:

Code:
SELECT avg(ifnull(i.price.price,0.0)) as avgPrice
from Item i...

The avg() and other functions seem to expect only a column name as the argument and not allow for another nested function...

Thanks for any help...

Eric


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.