求教,关于getHibernateTemplate().get(clazz, id)的问题
1.CommonDao中定义
public Object get(Class<T> clazz, Serializable id) throws DataAccessException {
return getHibernateTemplate().get(clazz, id);
}
2.service中调用,building_id已经转化成字符串类型
Building building=(Building) commonDao.get(Building.class, building_id);
3.现象:
building的值为null
控制台输出的sql为:select building0_.building_id as building1_2_0_, building0_.area_id as area2_2_0_, building0_.building_code as building3_2_0_, building0_.building_type as building4_2_0_, building0_.building_date as building5_2_0_, building0_.building_lease_state as building6_2_0_, building0_.building_floor_num as building7_2_0_, building0_.building_area as building8_2_0_, building0_.building_up_area as building9_2_0_, building0_.building_under_area as building10_2_0_, building0_.building_value as building11_2_0_, building0_.building_owner as building12_2_0_, building0_.building_remark as building13_2_0_, building0_.building_build_area as building14_2_0_, building0_.building_own_state as building15_2_0_, building0_.building_maintain_state as building16_2_0_, building0_.building_lease_money as building17_2_0_, building0_.building_seq as building18_2_0_ from b_building building0_ where building0_.building_id=?
请教各位大侠,为什么出现building_id=?,是哪里不对吗
------解决方案--------------------那是输出的sql=?不影响的。你复制那段sql语句去数据库查看看是否有值。