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.  [ 1 post ] 
Author Message
 Post subject: How to set fetch at runtime for createQuery
PostPosted: Thu Mar 24, 2005 8:25 am 
Newbie

Joined: Sun Mar 20, 2005 6:35 am
Posts: 3
Iam using Hibernate version 2.0 and would like to know how can i set fetch option at runtime.I dont want to use createCriteria as i will not be able to use projection.

my function looks like following

public ArrayList getActivatedAddendumFixedPricing(String addendumVersion,int startIndex,int numberOfResults,String mode)
throws HibernateException {

StringBuffer sb = new StringBuffer();
List objects = null;
ArrayList activatedAddendumFixedPrice = new ArrayList();
Query q =hibSession.createQuery("select fp,quote.quoteNo,quote.quoteVersion,qtr.quarter,qtr.year,qtr.quantity,fp.price,fp.currencyCd from ScheduleFixedPriceT fp,QuoteT quote,QtrFixedPriceT qtr where fp.status='A' and quote.fulfillmentType='I' and fp.addendumVersionT.version=:addendumVersion and quote.id=fp.quoteId and fp.fixedPriceId=qtr.fixedPriceT.id");
if(mode.equals("display")){
q.setFirstResult(startIndex);
q.setMaxResults(numberOfResults);
}
q.setInteger("addendumVersion",Integer.parseInt(addendumVersion));
objects=q.list();
Iterator iter=objects.iterator();

while (iter.hasNext())
{
activatedAddendumFixedPrice.add((Object[]) iter.next());
}

return activatedAddendumFixedPrice;
}


NOTE: I have set outer-join option as true.But I want to set fetch at runtime.

Thanks in advance


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

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.