querydsl

QueryDSL Generated classes not able to access second level elements for querying

好久不见. 提交于 2019-12-05 15:38:06
问题 I am using QueryDSL with Spring Data JPA in my Java Project and have Generated files using QueryDSL maven plugin to use the QueryDSL Model classes generated by it. This works great when i use it for one level nested objects, however if i try to access the 2nd level access objects it gives a NullPointerException saving the 2nd level model object is not initialized. Would appreciate some help. I am getting a NullPointerException in 3rd line qmachine.vendor is null. QTransaction qtransaction =

QueryDSL: join subquery

£可爱£侵袭症+ 提交于 2019-12-05 13:43:43
I would just like to check - for the QueryDSL version 3.1.1. - is it still impossible to join with a subquery, as is written in an answer here: JPQL / QueryDSL: join subquery and get aliased column Yes, still the same restriction. The restriction comes from JPA, so there is not much to be done about it in Querydsl. 来源: https://stackoverflow.com/questions/16459327/querydsl-join-subquery

How to make union query on Elasticsearch?

我的梦境 提交于 2019-12-05 12:47:31
I would like to make a query with UNION and limit. I can explain that query on mysql. (SELECT * FROM table WHERE type='text' LIMIT 3 ) UNION (SELECT * FROM table WHERE type='word' LIMIT 3 ) I tried it on Elasticsearch { "query":{ "dis_max":{ "queries":[ { "from":0, "size":3, "query":{ "match":{ "type":"text" } } }, { "from":0, "size":3, "query":{ "match":{ "type":"word" } } } ] } } } http://localhost:9200/test/table/_search?pretty&source= {%22query%22:{%22dis_max%22:{%22queries%22:[{%22query%22:{%22match%22:{%22type%22:%22test%22}}}]}}} Then, the error occured. { "error" : { "root_cause" : [ {

Spring with Query Dsl custom binding and or operation doesn't work

妖精的绣舞 提交于 2019-12-05 12:30:46
i have following reQuirement Query: "/article? category =kitchen& category =sports" This Query is working without custom bindings. It will give me all Kitchen and sports articles as Response. It is doing an OR-Operation somehow. But i need to customize the binding because i need to ingore the case. Now i am using this customize binding: @Repository public interface ArticleRepository extends JpaRepository<Article, Long>, QueryDslPredicateExecutor<QArticle>, QuerydslBinderCustomizer<QArticle> { @Override default public void customize(QuerydslBindings bindings, QArticle article) { bindings.bind

Querydsl Code generation for groovy with gradle

大憨熊 提交于 2019-12-05 11:15:42
I have entity beans defined in groovy. I'm not being able to generate querydsl code for entities in groovy. This Gradle Querydsl Configuration works fine for entity beans in Java but not for groovy. Referring to Querydsl documentation on Alternative code generation , it states that GenericExporter have to used to generate code for groovy entities. But I could not figure out how to configure GenericExporter in gradle. Please share if anyone have been able to generate querydsl code for entities in groovy with gradle. Thanks There seems to be a working solution I came up with just today. It

Maven build problems with spring-data-jpa and querydsl

时光总嘲笑我的痴心妄想 提交于 2019-12-05 10:27:26
I've got an Eclipse Maven project for spring-data-jpa and QueryDsl. I seem to have a problem with the maven-apt-plugin where if I do a mvn clean followed by a mvn install, it tries to "process" files that reference the QueryDsl generated files, but these generated files have not yet been built so I get multiple "cannot find symbol" errors. If then have to do another mvn install, everything is ok as the generated files now exist. Does this maven-apt-plugin need to process every file in my project, or can I give it a specified directory ? Note: Im using JDK6, Eclipse Indigo, M2E 1.0.100 My POM

QueryDSL - query specified join fetching, but the owner of the fetched association was not present in the select list

可紊 提交于 2019-12-05 08:26:57
In my Spring Boot,Data/JPA 2.1/QueryDSL application I have a following entity: @Entity @NamedEntityGraph(name = "graph.CardCategoryLevel", attributeNodes = { @NamedAttributeNode("cardCategory"), @NamedAttributeNode("level") }) @Table(name = "card_categories_levels") public class CardCategoryLevel extends BaseEntity implements Serializable { @Id @SequenceGenerator(name = "card_categories_levels_id_seq", sequenceName = "card_categories_levels_id_seq", allocationSize = 1) @GeneratedValue(strategy = GenerationType.AUTO, generator = "card_categories_levels_id_seq") private Long id; @OneToOne

Overriding Spring-Data-JPA default method annotating with EntityGraph causes QueryException

橙三吉。 提交于 2019-12-05 07:43:36
I'm trying to implement a EntityGraph with Data-JPA, since using QueryDslPredicateExecutor<T> exposes the method findAll(Predicate, Pageable) the one I need, I tried to override it to annotate with @EntityGraph then the troubles began it's throwing : org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=appointment,role=com.physioclinic.entity.Appointment

querydsl transformer group by count

六眼飞鱼酱① 提交于 2019-12-05 04:26:56
I am stuck trying to get a query (QueryDSL) to work that gives me a count of distinct categories. For example, what I am trying to achieve: categoryA -> 10 entries categoryB -> 20 entries This is what i have so far: query().from(application) .transform(groupBy(application.category).as(list(application))); However, this gives me for each category a list of all whole entries, I just want to get a count of this. I tried messing around with count() but no luck. Anybody know how to do this? transform combined groupBy is meant to construct tree structures out of flat result sets. What you need can

IntelliJ 15 with QueryDSL and Gradle

心已入冬 提交于 2019-12-05 04:00:49
I have a Spring-boot 1.4 project in IntelliJ 15 using gradle 2.3 and QueryDSL 4.1.3 that won't build because my entities are not being built into Q classes by Querydsl. I have the following: buildscript { ext { springBootVersion = '1.4.0.BUILD-SNAPSHOT' querydslVersion = '4.1.3' } repositories { mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } maven {url "https://plugins.gradle.org/m2/"} } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath "gradle.plugin.com.ewerk.gradle