List<AddHotelBean> list=new ArrayList<AddHotelBean>();
List<HotelFacilities> list1=new ArrayList<HotelFacilities>();
public String execute(){
Configuration cfg=new Configuration();
cfg.configure();
SessionFactory sf=cfg.buildSessionFactory();
Session session= sf.openSession();
SQLQuery q=session.createSQLQuery("select d.name,d.country,f.monday,f.tuesday from hotel.hoteldetails1 d , hotel.hotelfacilities1 f where d.hotelid=f.hotelid;");
q.addScalar("name", StandardBasicTypes.STRING);
q.addScalar("country", StandardBasicTypes.STRING);
q.addScalar("monday", StandardBasicTypes.STRING);
q.addScalar("tuesday", StandardBasicTypes.STRING);
q.setResultTransformer(Transformers.aliasToBean(HotelFacilities.class));
List<HotelFacilities> l=q.list();
for(HotelFacilities a:l) {
a.getMonday();
a.getTuesday();
list1.add(a);
}
org.hibernate.QueryParameterException: could not locate named parameter [hotelid]
我得到这个例外请任何人帮助我
实际上我的疑问是我正在使用两个 pojo 类,但我的 Transformers.aliasToBean 只是一个类,它实际上需要两个类的东西才能在我的输出 jsp 页面中打印
提前致谢。
`