春天边边,今天被误导,在此记录在侧!
起因:接收一个用SpringSide开发的项目,今天在后台调用如下代码:
userGroup = userGroupDao.get(id);
其中:
public class UserGroupDao extends HibernateDao<UserGroup, Integer>
满心以为当如果从DB中没有检索到对应条件的记录则返回null,但是null后续的业务一直进不去。从google上的结果都说检索结果为空时get()返回null,load()返回一个代理对象,怎么我用起来结果就不对了呢?debug时发现userGroup中多了个handler属性,其余属性皆为null,对handler没有敏感,查来查去找不到问题原因,无奈直接查看引用的jar包,顿时天雷滚滚~~
请看jar中get()方法的定义:
public Object get(Serializable id) {
Assert.notNull(id, "id不能为空");
return getSession().load(entityClass, id);
}
什么get()\load(),一样货色!
哎,误人误人啊,特此记录!
分享到:
相关推荐
SpringSide对Hibernate做了三层封装: 第一层:HibernateGenericDao,基于spring的HibernateDaoSupport,但加入了分页函数与各种Finder函数,并使用泛型避免了返回值强制类型转换。 第二层:HibernateEntityDao,...
springside3 hibernate关联关系api 博文链接:https://calm-forjava.iteye.com/blog/981576
springside3文档资料收录 calvin,游侠
SpringSide3框架,SpringSide3框架SpringSide3框架SpringSide3框架
springside3-core-3.2.2
springside3的jar包,并附属源码
springside3-extension-3.3.4.jar
找了很久:包里包含以下2个文件;csdn上的那个只有一个extension; springside3-core-3.3.4.jar springside3-extension-3.3.4.jar
springside3-core-3.3.4.jar
springside3-core-3.3.4.jar
springside3与传统ssh区别: 1.1 数据库设计 1.2 entity 对象 1.3 dao对象 1.4 manager对象 1.5 action 对象 .......................
这是springside源包,导入可查看dao层源码
springside3-core-3.0.4.jar
SpringSide3开发环境mini-web项目_3 一共三个压缩包: http://download.csdn.net/source/1725011 http://download.csdn.net/source/1725015 http://download.csdn.net/source/1725311
springside
springside3-core-3.0.4 源码