hibernate左连接查询时在easyUI的dataGrid中有些行取值为空的解决办法
1 当使用left join左连连接,sql语句为
select t from SecondPage t left join t.rightNavbar n where 1=1
页面中出现了部分空行的情况,上述语句返回的list集合为
DataGrid dataGrid = new DataGrid();
List<SecondPage> list=secondPageDao.find(model, paging);
dataGrid.setRows(list);
dataGrid.setTotal(secondPageDao.count(model));
return dataGrid;
遍历list的值,发现list里边的每一项都是有值的,我就没有理解,为什么直接把listset到row中,页面上就是有空格存在,但是我加了下面代码后解决了这个问题,如果有经验的朋友欢迎提供说明
DataGrid dataGrid = new DataGrid();
List<SecondPage> list=secondPageDao.find(model, paging);
Iterator<SecondPage> it = list.iterator();
/**解决空格的问题,前台取不到值**/
List<SecondPage> listCopy = new ArrayList<SecondPage>();
while (it.hasNext()) {
SecondPage s = (SecondPage) it.next();
SecondPage copy = new SecondPage();
BeanUtils.copyProperties(s, copy);
listCopy.add(copy);
}
/**结束**/
dataGrid.setRows(list);
dataGrid.setTotal(secondPageDao.count(model));
return dataGrid;
hibernate左连接查询时在easyUI的dataGrid中有些行取值为空的解决办法的更多相关文章
- SQL左连接查询 left join ... on
左连接查询 保留左边主表的所有行(即使在右表没有匹配的行),右表输出满足 on 条件的行,不满足的输出null 示例:组合两个表 - 力扣 表1: Person +--------------+- ...
- 当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式。
当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式.比如 select * from T_Employee where FNumber not in ( select top 5* ...
- hibernate导入大量数据时,为了避免内存中产生大量对象,在编码时注意什么,如何去除?
Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); for ( i ...
- 在EasyUI的DataGrid中嵌入Combobox
在做项目时,须要在EasyUI的DataGrid中嵌入Combobox,花了好几天功夫,在大家的帮助下,最终看到了它的庐山真面: 核心代码例如以下: <html> <head> ...
- SQL2005:SQL Server 2005还原数据库时出现“不能选择文件或文件组XXX_log用于此操作的解决办法
SQL2005 还原数据库失败,提示如下: SQL Server 2005还原数据库时出现“不能选择文件或文件组XXX_log用于此操作的解决办法 出现错误时操作步骤为:右击数据库--->任务- ...
- SQL Server 2005还原数据库时出现“不能选择文件或文件组XXX_log用于此操作的解决办法
SQL2005 还原数据库失败,提示如下: SQL Server 2005还原数据库时出现“不能选择文件或文件组XXX_log用于此操作的解决办法 出现错误时操作步骤为:右击数据库--->任务- ...
- VMware下ubuntu与win8共享文件时/mnt/hgfs目录为空的解决办法
VMware下ubuntu(guest)与win8共享文件时/mnt/hgfs目录为空的解决办法 环境:VMware-player-5.0.2-1031769 + ubuntu13.04 1.安装vm ...
- Thinkphp中查询复杂sql查询表达式,如何表达MYSQL中的某字段不为空is not null?
Thinkphp中查询复杂sql查询表达式,如何表达MYSQL中的某字段不为空is not null?先上两种实现方式的实例:$querys["house_type_image"] ...
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session异常解决办法
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread ...
随机推荐
- 分布式系统之CAP原理
参考链接:http://blog.csdn.net/wireless_com/article/details/79153643 CAP是什么? CAP理论,被戏称为[帽子理论].CAP理论由Eric ...
- ==和Equal()
1.a==null与 null==a null放在前面就是为了避免变量为空时 引了空指针异常 如: if(a==null) 如果a 真为空时,现在就相当用调用了变量a的方法,a 都为空了还调用他的方法 ...
- opener和parent的区别
openeropener用于在window.open的页面引用执行该window.open方法的的页面的对象.例如:A页面通过window.open()方法弹出了B页面,在B页面中就可以通过opene ...
- 【转】Linux下的CPU使用率与服务器负载的关系与区别
当我们使用top命令查看系统的资源使用情况时会看到load average,如下图所示,它表示系统在1,5,15分钟的平均工作负载. 那么什么是负载(load)呢?它和CPU的利用率又有什么关系呢? ...
- R3300L按reset键无法进入USB Burning模式的问题分析
最开始并没有注意到这个问题, 因为从设备拿到手, 用USB Burning Tool刷入潜龙版的安卓4.4.2, 再到运行EmuELEC, Armbian, 再到给Kernel 5.3的Armbian ...
- paddlepaddle如何预加载embedding向量
使用小批量数据时,模型容易过拟合,所以需要对全量数据进行处理,我是用的是word2vec训练的词向量. 那么训练好对词向量如何加载呢? #!/usr/bin/env python # -*- codi ...
- JFinal 数据库“手动”事务(提交、回滚)
一.用注解 @Before(Tx.class) 实现 事务回滚 @Before(Tx.class) public void pay() throws Exception { //throws exce ...
- aardio调用dll
刚知道aardio这个不错的玩具,可惜作者停更了,贴一个调用dll的例子备用吧 vc代码 extern "C" _declspec(dllexport) int _stdcall ...
- MySQL Shared and Exclusive Locks
官方文档 InnoDB implements standard row-level locking where there are two types of locks, shared (S) loc ...
- QByteArray数据进行CRC32校验时产生的随机结果
QT中使用QByteArray来存放了C++中的char数组. 两端使用相同的crc32进行校验,QT中却产生了随机的校验结果, C++端产生唯一的正确校验结果. 查看QByteArray相关资料,未 ...