-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: whats wrong with this query
PostPosted: Thu Sep 01, 2005 10:36 am 
Newbie

Joined: Mon Aug 22, 2005 3:34 am
Posts: 7
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=?


Top
 Profile  
 
 Post subject: whats wrong with this query
PostPosted: Thu Sep 01, 2005 10:42 am 
Newbie

Joined: Thu Jan 13, 2005 11:09 pm
Posts: 5
Location: Springdale,AR
Are you using Weblogic and Hibernate 3 ? If yes, then you need to have antlr file in the classpath of the application server.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 4:15 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try generated sql with any sql tools (I don't know sql server, but you can try any tools with jdbc or pure jdbc) - it take long time , maybe

antlr is good when exists generated sql


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.