I'm trying to run this query:
Code:
"select distinct p, count(ol) " +
"from Order d " +
"join d.lines ol " +
"join ol.referenceProduct p " +
"join p.options o " +
"join p.catalogs c " +
"join p.parentBrand b " +
"where o.stockAvailable > 0 " +
"and d.creationDate > :date " +
filter +
"group by p.id, p.regularPrice, p.reference, p.buyPrice, " +
"p.creationDate, p.lastModification, p.bargain, p.referenceNumber, " + "p.promoPrice, p.stockAvailable, p.imageUsed, p.parentBrand.id " +
"order by count(ol) desc";
Since I have to "group by" by hand, but I just can't find how to group by p.id_brand (many-to-one to Brand)....
Can some one give me an hint?
p.parentBrand.id doesn't work, neither did p.parentBrand.
Thanks
Alex