what's wrong with this qeury
Query query1 = session.createQuery("from OrderBean order,CustomerBean customer where order.intCustomerId = customer.customerId and order.dateField = :strDate");
query1.setParameter("strDate",strDate);
hibernate generates sql as shown below and application server halts,
no action
Hibernate version:3.0
my hibernate code is as under
Code between sessionFactory.openSession() and session.close():
String strDate = (String) request.getParameter("date"); System.out.println("Date : " + strDate); Query query1 = session.createQuery("from OrderBean order,CustomerBean customer where order.intCustomerId = customer.customerId and order.dateField = :strDate"); query1.setParameter("strDate",strDate); List orderList = query1.list(); Iterator iter1 = orderList.iterator(); Vector orderVector = new Vector(); Vector customerVector = new Vector(); while (iter1.hasNext()){ Object[] tuple = (Object[]) iter1.next(); OrderBean order = (OrderBean) tuple[0]; orderVector.add(order); CustomerBean customer = (CustomerBean) tuple[1]; customerVector.add(customer); } request.setAttribute("orderVector", orderVector); request.setAttribute("customerVector", customerVector); return actionMapping.findForward("allOrders");
Name and version of the database you are using: SQL Server 2000
The generated SQL (show_sql=true):
Hibernate: select orderbean0_.ORDER_ID as ORDER1_0_, customerbe1_.CUSTOMER_ID as CUSTOMER1_1_, orderbean0_.ORDER_DATE as ORDER2_2_0_, orderbean0_.TOTAL_AMOUNT a s TOTAL3_2_0_, orderbean0_.CUSTOMER_ID as CUSTOMER4_2_0_, customerbe1_.CUSTOMER_ NAME as CUSTOMER2_1_1_ from ORDERINFO orderbean0_, CUSTOMER customerbe1_ where o rderbean0_.CUSTOMER_ID=customerbe1_.CUSTOMER_ID and orderbean0_.ORDER_DATE=?
|