db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Ciocci <l.cio...@askweb.it>
Subject CountHelper and criteria.clone()
Date Tue, 06 Jul 2010 15:52:16 GMT
Hello, 
 I discover the CountHelper object and I think that could be very
usefull, but I have seen that it modify the original criteria object
adding a select count(*) to the query.

So my question is: exist a way to real copy the criteria object before
use the CountHelper (or exists another trick?)

A simple code like this not work:

List list=new LinkedList();
Criteria criteria=new Criteria();
criteria.add(MyTablePeer.MyColumn,'MyValue'); //Adding a simple column

Criteria criteriacount=(Criteria)criteria.clone(); //Important
CountHelper counthelper=new CountHelper(criteriacount);
int recordcount=counthelper.count();

if (recordcount<1000) {
	list=MyTablePeer.doSelect(criteria);
	//This instruction fail and throw DataSetException
}


Thanks in advance.
Luca


-- 
Ing. Luca Ciocci
ASK srl
tel 059 271417
fax 059 3683560


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message