Criteria Builder very light on features

I just came across some features of CriteriaBuilder that seems to be missing in ColdBox, this means one can’t write code like this.

personCriteria = builder.createQuery( 'Person' );
// create and add the root
person.from( 'Person' );

Is something like this going to be on the radar for ColdBox?

Reference :
https://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/querycriteria.html

Can you put in some tickets for the specific features that you’d like to see, Andrew? Much of what Criteria Builder does was submitted by the community so we’d love help adding useful stuff.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Cheers Brad, just wanted to check if there was a way it could already be done, in case I was missing something.

You mean change the root entity?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Not sure what you mean there Luis.

No problem Andrew, let me see if I can clarify:

I just came across some features of CriteriaBuilder that seems to be missing in ColdBox, this means one can’t write code like this.

personCriteria = builder.createQuery( 'Person’ )

That is creating a criteria query object based on a root entity from where all things are expressed →


A CriteriaQuery object defines a query over one or more entity, embeddable, or basic abstract schema types. The root objects of the query are entities, from which the other types are reached by navigation.
> --[JPA 2 Specification, section 6.5.2 Query Roots, pg 262])

Is this what you meant or what feature?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox

Yeah, that sounds about right. I am assuming that is how that JPA code works.

Btw I had to look it up again, here is the javadoc

http://docs.oracle.com/javaee/6/api/javax/persistence/criteria/CriteriaQuery.html

I think it is just a matter of exposing these as well, where as ColdBox returns a CF object.

Andrew, we have abstracted that object, but you have access to it as well. We do lots of onMissing method funkiness to make it easier to work with. But you can get the native criteria object as well via the ColdBox criteria builder: getNativeCriteria()

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408

ColdBox Platform: http://www.coldbox.org

ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483

Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox