为什么在mysql工具中可以运行,但在hibernate项目中报这样的错呢
Hibernate:selecttable1.id,table1.name,table1.yname,table1.a1,table1.a2,table1.a3,(tab...
Hibernate:
select
table1.id,
table1.name,
table1.yname,
table1.a1,
table1.a2,
table1.a3,
(table1.a1+table1.a3-table1.a2)
from
(select
t1.EmployeeID id,
t1.ename name,
t1.eyname yname,
ifnull(t1. sum1 ,
0) a1,
ifnull(t2.sum2,
0) a2,
ifnull(t3.time,
0) a3
from
(select
s.ename,
s.eyname,
s.EmployeeID,
sum(o.overhours ) as sum1
from
Staff s
left join
Overtime o
on s.EmployeeID=o.EmployeeID
group by
s.EmployeeID)t1 ,
(select
s.EmployeeID,
sum(e.extrahours ) as sum2
from
Staff s
left join
Extra e
on s.EmployeeID=e.EmployeeID
group by
s.EmployeeID)t2 ,
(select
EmployeeID,
time
from
Surplus_annual ) t3
where
t1.EmployeeID=t2.EmployeeID
and t1.EmployeeID=t3.EmployeeID
)table1
2013-02-27 14:41:42,253 [org.hibernate.type.DoubleType]-[INFO] could not read column value from result set: ; Column '' not found.
2013-02-27 14:41:42,253 [org.hibernate.util.JDBCExceptionReporter]-[WARN] SQL Error: 0, SQLState: S0022
2013-02-27 14:41:42,253 [org.hibernate.util.JDBCExceptionReporter]-[ERROR] Column '' not found. 展开
select
table1.id,
table1.name,
table1.yname,
table1.a1,
table1.a2,
table1.a3,
(table1.a1+table1.a3-table1.a2)
from
(select
t1.EmployeeID id,
t1.ename name,
t1.eyname yname,
ifnull(t1. sum1 ,
0) a1,
ifnull(t2.sum2,
0) a2,
ifnull(t3.time,
0) a3
from
(select
s.ename,
s.eyname,
s.EmployeeID,
sum(o.overhours ) as sum1
from
Staff s
left join
Overtime o
on s.EmployeeID=o.EmployeeID
group by
s.EmployeeID)t1 ,
(select
s.EmployeeID,
sum(e.extrahours ) as sum2
from
Staff s
left join
Extra e
on s.EmployeeID=e.EmployeeID
group by
s.EmployeeID)t2 ,
(select
EmployeeID,
time
from
Surplus_annual ) t3
where
t1.EmployeeID=t2.EmployeeID
and t1.EmployeeID=t3.EmployeeID
)table1
2013-02-27 14:41:42,253 [org.hibernate.type.DoubleType]-[INFO] could not read column value from result set: ; Column '' not found.
2013-02-27 14:41:42,253 [org.hibernate.util.JDBCExceptionReporter]-[WARN] SQL Error: 0, SQLState: S0022
2013-02-27 14:41:42,253 [org.hibernate.util.JDBCExceptionReporter]-[ERROR] Column '' not found. 展开
2个回答
展开全部
你这是SQL语句,你用的是session.createSQLQuery(sql)吗?
追问
是的,我找到问题所在了,是ifnull()函数的问题,不用这个就对了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询