1. Check null for result returned by get, because if the object specified by identifier id is not exist in db, null will be returned 2. Check the list returned by hibernate, 2.1 check whether the list is null (by default, hibernate returns a list with 0 item, not null) 2.2 check whether the list size is larger than 0
Summary on 20080703: Attention for hibernate operation
最新推荐文章于 2022-01-19 17:46:30 发布
本文介绍了使用Hibernate进行数据库查询时需要注意的两个关键步骤:首先检查通过get方法返回的对象是否为null,以防标识符对应的对象不存在于数据库中;其次验证Hibernate返回的列表是否为空及列表长度是否大于零。
2万+

被折叠的 条评论
为什么被折叠?



