取消懒加载
Configuration cfg = new Configuration().configure();
cfg.addClass(Vm.class);
//设置取消懒加载
cfg.getCollectionMapping("com.chinac.chs.pojo.Room.pools").setLazy(false);
SessionFactory sessionFactory = cfg.buildSessionFactory();
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
InstanceDaoImpl instanceDaoImpl = new InstanceDaoImpl();
instanceDaoImpl.setHibernateTemplate(hibernateTemplate);
cfg.addResource("cn/itcast/a_helloworld/User.hbm.xml")
cfg.addClass(User.class);//去User类所在的包中查找名称为User,后缀为.hbm.xml的文件
lazy:"extra"
size()
count()
Hibernate.initialize(department.getEmployees());