关于hibernate get问题
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws Exception {
LoginActionForm loginfrom = (LoginActionForm)form;
User user = loginfrom.getUser();
//数据库的访问:根据user load出一个user_temp
User user_temp= userbus.loginUser(user);
if(user_temp!=null){
HttpSession session = req.getSession();
Set orders = user_temp.getOrders();//获得它的orders集合
//但是为什么只有当我执行orders.size()的时候它才会去load的出对应的orders如果不加这句他就不会load出orders
orders.size();
session.setAttribute("orders",orders);
session.setAttribute("user", user_temp);
return mapping.findForward("index");
}
return mapping.findForward("register");
}
我的 User 与 orders 是一对多的关系