Thanks
I am trying to evaluate if QueryDSL will solve a similar need for us. We want to dynamically sort and filter entities based on properties of abstract parent properties as well as columns in joined entity tables specific to each entity. FYI, we are using Spring Data JPA. So far, based on other posts I am starting to see how this could work, although the fact that the QClasses don't extend the abstract Q class for the entities has kind of thrown me for a loop. I think I can get around that later with a parameterized Predicate building helper class or the like.
However, being very new to querydsl, I am finding it hard to translate the other advice above into code. I'd like to add a few things to my query without the Q classes, based on table and column name conventions we have in place. For example I have a Category entity that extends our AbstractEntity base class that adds things like a global companyId. I can do this as long as I know the QClass:
QAbstractEntity abstractEntity = new QAbstractEntity (QCategory.category);
Predicate predicate = abstractEntity.companyId.eq(companyId);
entityPage = getRepository().findAll(predicate, pageable); //querying spring data jpa repository
I would like to add some additional things to the predicate. Primarily, join in a one-to-many category_data table and sort by some of it's columns. It would be similar to what Timo answered here...
http://forum.springsource.org/showthread.php?110466-Forming-a-QueryDSL-Predicate-through-a-OneToMany-join
...except I would need to do it abstractly, not using the QClasses and evaluating the join table name and columns as strings.
Any links to or samples of dynamically building this type of Predicate would be a great help. If further examples of the classes or tables I am working with would help, please let me know, but at this point I'm only marginally sure my post makes any sense at all. Thanks!
--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You can't declare explicit joins in a Predicate, that happens on the Query level
--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You can use Querydsl queries inside Spring Data repositories, you just need to go beyond the helper methods.