这个是原始sql语句
String sql = "select u.id, u.sid , u.name , a.approveNum , a.approveNumTotal , a.id " +
" from tbl_user as u " +
" left join tbl_apply as a on u.id=a.userId AND a.sid like '%" + verifyIdS + "%' " +
" AND a.sure=2 "+
" where u.sid like '%D%' OR u.sid like '%H%' " +
" ORDER BY u.id ASC ";
SQLQuery sqlQuery = sessionFactory.getCurrentSession().createSQLQuery(sql);
List listT = sqlQuery.list();
return listT;以下是控制台的信息11:46:43,598 DEBUG JDBCTransaction:54 - begin
11:46:43,599 DEBUG ConnectionManager:421 - opening JDBC connection
11:46:43,600 DEBUG JDBCTransaction:59 - current autocommit status: true
11:46:43,602 DEBUG JDBCTransaction:62 - disabling autocommit
11:46:49,866 DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
11:46:49,878 DEBUG SQL:401 -
select
u.id,
u.sid ,
u.name ,
a.approveNum ,
a.approveNumTotal ,
a.id
from
tbl_user as u
left join
tbl_apply as a
on u.id=a.userId
AND a.sid like '%201101%'
AND a.sure=2
where
u.sid like '%D%'
OR u.sid like '%H%'
ORDER BY
u.id ASC
Hibernate:
select
u.id,
u.sid ,
u.name ,
a.approveNum ,
a.approveNumTotal ,
a.id
from
tbl_user as u
left join
tbl_apply as a
on u.id=a.userId
AND a.sid like '%201101%'
AND a.sure=2
where
u.sid like '%D%'
OR u.sid like '%H%'
ORDER BY
u.id ASC
11:46:49,896 DEBUG AbstractBatcher:382 - about to open ResultSet (open ResultSets: 0, globally: 0)
11:46:49,934 DEBUG AbstractBatcher:389 - about to close ResultSet (open ResultSets: 1, globally: 1)
11:46:49,943 DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
11:46:49,954 DEBUG StatefulPersistenceContext:787 - initializing non-lazy collections
String sql = "select u.id, u.sid , u.name , a.approveNum , a.approveNumTotal , a.id " +
" from tbl_user as u " +
" left join tbl_apply as a on u.id=a.userId AND a.sid like '%" + verifyIdS + "%' " +
" AND a.sure=2 "+
" where u.sid like '%D%' OR u.sid like '%H%' " +
" ORDER BY u.id ASC ";
SQLQuery sqlQuery = sessionFactory.getCurrentSession().createSQLQuery(sql);
List listT = sqlQuery.list();
return listT;以下是控制台的信息11:46:43,598 DEBUG JDBCTransaction:54 - begin
11:46:43,599 DEBUG ConnectionManager:421 - opening JDBC connection
11:46:43,600 DEBUG JDBCTransaction:59 - current autocommit status: true
11:46:43,602 DEBUG JDBCTransaction:62 - disabling autocommit
11:46:49,866 DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
11:46:49,878 DEBUG SQL:401 -
select
u.id,
u.sid ,
u.name ,
a.approveNum ,
a.approveNumTotal ,
a.id
from
tbl_user as u
left join
tbl_apply as a
on u.id=a.userId
AND a.sid like '%201101%'
AND a.sure=2
where
u.sid like '%D%'
OR u.sid like '%H%'
ORDER BY
u.id ASC
Hibernate:
select
u.id,
u.sid ,
u.name ,
a.approveNum ,
a.approveNumTotal ,
a.id
from
tbl_user as u
left join
tbl_apply as a
on u.id=a.userId
AND a.sid like '%201101%'
AND a.sure=2
where
u.sid like '%D%'
OR u.sid like '%H%'
ORDER BY
u.id ASC
11:46:49,896 DEBUG AbstractBatcher:382 - about to open ResultSet (open ResultSets: 0, globally: 0)
11:46:49,934 DEBUG AbstractBatcher:389 - about to close ResultSet (open ResultSets: 1, globally: 1)
11:46:49,943 DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
11:46:49,954 DEBUG StatefulPersistenceContext:787 - initializing non-lazy collections
解决方案 »
- SWT监听器传值,救命...
- 在JAVA中,怎么把long的数字准确的转化为日期类型呢?答对的给40分
- jk shared memory 是做什么用的?
- jfreechart如何时配置啊
- 求推荐本好点的structs2书籍 一定要有案例
- 一个webwork的问题
- java海量数据的处理
- tomcat连接池问题(查过资料后也没找到答案)
- 请教各位,用jbuider做了一个应用程序,有界面的,怎样打包成安装程序,让用户直接安装,而不用装jre或其他东西?
- 在自定义标志中如何使用struts的html:option
- 同一个项目hibernate 就是查不出数据jdbc就可以查出
- javawweb开发技术
如果你SQL语句在如:plsql下都无法跑出数据那就当然没有数据。