CountHelper and criteria.clone()

Luca Ciocci <[email protected]> Tue, 06 Jul 2010 17:52:16 +0200
Newsgroups gmane.comp.jakarta.turbine.torque.user
Message-ID <[email protected]>
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