-->
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: Two times calling session.creaeQuery()..2nd one is not worki
PostPosted: Wed Dec 13, 2006 2:23 am 
Newbie

Joined: Mon Nov 06, 2006 9:46 am
Posts: 10
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp




StringBuffer clause1=new StringBuffer();
StringBuffer clause2=new StringBuffer();
List changeLogList =null;
List changeLogList1 = null;
String sortBy=form.getSortBy();
String listOrder=form.getListOrder();
String arItemSkey=form.getArItemSkey();
hibSession = HibernateUtil.getSessionFactory().openSession();

clause1.append("select new fit.gdms.viewbeans.AritemChgLogDTO(u.userEmail,TimeStamp(ar.lastUpdTs),ar.chgItem,ar.oldChgValue,ar.newChgValue) from fit.gdms.schemadao.AritemChgLog ar,fit.gdms.schemadao.UserAccProfile u where ar.arItem.arItemSkey ="+arItemSkey+" and ar.lastUpdId=u.user.userCnum ");
clause2.append(" select new fit.gdms.viewbeans.AritemChgLogDTO(u.userEmail,TimeStamp(fr.lastUpdTs),fr.chgItem,fr.oldChgValue,fr.newChgValue) from fit.gdms.schemadao.FcstChgLog fr,fit.gdms.schemadao.UserAccProfile u where fr.forecast.arItem.arItemSkey ="+arItemSkey+" and fr.lastUpdId=u.user.userCnum ");

changeLogList1 = hibSession.createQuery(new String(clause1)).list();
changeLogList = hibSession.createQuery(new String(clause2)).list();
-------------------------------------------------------------------------------------


here Hibernate exception is raising at..here
changeLogList = hibSession.createQuery(new String(clause2)).list();

But changeLogList1 = hibSession.createQuery(new String(clause1)).list();
is working


DB2 8.1 is the database


How can I solve this ?Expecting the immediate reply











Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 4:22 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
If you don't post the exception you are getting nobody will be able to help you.

BTW:
- Why do you use a StringBuffer when you do String concatenation inside the append methods?

- ALWAYS use Bind variables !!

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 7:55 am 
Newbie

Joined: Mon Nov 06, 2006 9:46 am
Posts: 10
MikePloed wrote:
If you don't post the exception you are getting nobody will be able to help you.

BTW:
- Why do you use a StringBuffer when you do String concatenation inside the append methods?

- ALWAYS use Bind variables !!



I got the ans. clause2 sytax was not correct .(associated with table relations).


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.