--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cf-or...@googlegroups.com.
Visit this group at https://groups.google.com/group/cf-orm-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+unsubscribe@googlegroups.com.
this should be surely much simpler than q sql join-ed query
I’m going to second Criteria builder, it makes queries like this fairly straightforward, and allows for dynamic assembly much easier than HQL
. It can be used outside of Coldbox, by just adding a mapping and then you can use the Virtual Entity Service to access all of the available Base ORM Service methods. Using
your original example, the criteria with the join would look something like this:
var authorService = new cborm.models.VirtualEntityService( "author" );
var c = authorService.newCriteria();
var r = c.restrictions;
c.resultTransformer( C.DISTINCT_ROOT_ENTITY );
c.add( r.eq( "name", "Bob" ) );
c.createAlias( "articles", "articles" );
c.add( r.eq( "articles.datePublished", arguments.publishDate ) );
return c.list( asQuery=false );
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+...@googlegroups.com.
To post to this group, send email to cf-or...@googlegroups.com.
Visit this group at https://groups.google.com/group/cf-orm-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cf-orm-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cf-orm-dev+...@googlegroups.com.
hql = "
select distinct
au
from
Author au
join auth.articles ar
where
au.name = :authorName and
ar.datePublished = :datePublished
";
authors = ormExecuteQuery(hql, {
authorName:"Bob",
datePublished:"12/01/2017"
});