coldbox BE criteriabuilder

Is there a way to do a query of a query with criteriabuilder or any part of ColdBox ORM?

Jeremy R. DeYoung
615.261.8201jeremy.deyoung@lunarfly.comLunarFly.com

I don’t think that is even possible with CF-ORM.

@jeremy - What are you trying to do?

i am trying to run a large query, parse the data inside a loop then persist it to the database if any changes exists. something like

loop(){
var getData = service.findAllWhere(criteria={something})

if(changed){
service.save(getData);
{

}

however it is running a query many thousands of times. Its far more efficient to query the entire set of records, the filter only the records I need.

var getAllDataFirst = largeQuery;

loop(){
var getData = largeQuery.findAllWhere(criteria)


}

any ideas? does that make sense?

If I do this with query of a query in cfscript it cuts out about 80% of the time to run my script -
however I’ve written everything with hibernate and can’t figure out how to do it.

It actually appears that if I pre-fetch the data as one large ORM query - hibernate is intelligent enough to just use cache for the service.get(ID) request. Pretty neat…might be wrong but it appears to work this way.

There is no reason you can’t mix the two, for example run your ORM with the criteria you need and return it as a query and then use cfquery to do a QoQ. But I think that is defeating what you are trying to achieve.

But I think you are right, the caching of Hibernate would be beneficial with the fetch option.

Something that I am not hugely familiar with.

I am also assuming that this is a once of type of thing, in other words this is not something that all users would be running?

yes, its a script i’m running to compute data.

after some playing around, tweaking of the service.getAll() and a few other code changes. The script is now taking 52 seconds to run where before it was taking well over 1500 seconds :slight_smile:

Caching, using RAM:/// and a few other railo features is a beautiful thing.

thanks for your help.

Beauty

Luis Majano
CEO
Ortus Solutions, Corp
Toll Free/Fax: 1-888-557-8057
Direct: 909-248-3408
www.ortussolutions.com
Twitter: @lmajano, @ortussolutions