Below is a SQL statement that works anywhere except when I use it through hibernate. Can anyone see anything that I am doing wrong or any suggestions.
Call: (Double) getSession().createSQLQuery(AVG_DAILY_FILE_SIZE).uniqueResult();
Hibernate:
/* dynamic native SQL query */ select
avg(avg_daily_file_size / (select
count(distinct date)
from
Issue i,
File f
where
i.issue_id = f.issue_id)) as total
from
(select
sum(f.file_size) as avg_daily_file_size
from
Issue i,
File f
where
i.issue_id = f.issue_id
group by
i.date) as total_a
Error:
ERROR [JDBCExceptionReporter] Column '' not found.
ERROR org.hibernate.exception.SQLGrammarException: could not execute query
Thanks in advance for your help.
|