querydsl

NullPointerException on QueryDSL where clause

纵然是瞬间 提交于 2021-01-28 00:30:22
问题 Using Query DSL with hibernate (Spring Data JPA) to build a query like so if( bankId != null ){ query.where( coopMember.personId.bankAccountId.isNotNull().and( coopMember.personId.bankAccountId.bankBranch.bankId.eq(bankId)) ); } return query.fetch(); The logic here is simple: if there is a bank account associated with a person, filter the results by bank id. The BankAccount entity has a BankBranch which holds bankId integer value. A CoopMember entity may or may not have a BankAccount Problem

how to reference JPA annotated classes from jar dependency to generate QueryDsl Q classes?

南笙酒味 提交于 2021-01-28 00:06:09
问题 I have the @Entity annotated classes on Project A. Project B has a dependency on Project A. I want to generate QueryDsl Q classes on Project B, so Project A would not have a dependency on QueryDsl. If i follow the standard instructions (as described in http://www.querydsl.com/static/querydsl/4.1.3/reference/html_single/) to enable QueryDsl with JPA on Project B, it does not detect the annotated classes on project B. According to this Github issue (https://github.com/querydsl/querydsl/issues

Is it possible to use a Enum-Method in a QueryDSL query

Deadly 提交于 2021-01-27 19:05:56
问题 I have an entity type that contains an enum field. I use a JPA 2.1 AttributeConverter to map enum instances/values to a database column. The Enum values contain additional information I'd like to use in a QueryDSL query as if that information would be stored in the database. Example: A message entity that contains a messageType. The type is a enum value. The enum determines if the message is global or not. In the database, the enum is represented as an int-value. The information if global or

Spring Boot 2 + Java 9 + Querydsl

一个人想着一个人 提交于 2021-01-27 14:54:49
问题 I have successfully updated my application (Spring Boot + Java + Maven) to Spring Boot 2. Now I'm trying to update to Java 9. According to Nicolas Fränkel's blog post (Migrating a Spring Boot application to Java 9 - Compatibility) I accomplished to update to Java 9 without using a module-info file. But when I create such a file, the apt-maven-plugin gets stucked on creating the Q-types. Has anyone successfully completed using Java 9 + Maven + Querydsl? My Maven configuration for the apt-maven

Spring Boot 2 + Java 9 + Querydsl

戏子无情 提交于 2021-01-27 14:34:46
问题 I have successfully updated my application (Spring Boot + Java + Maven) to Spring Boot 2. Now I'm trying to update to Java 9. According to Nicolas Fränkel's blog post (Migrating a Spring Boot application to Java 9 - Compatibility) I accomplished to update to Java 9 without using a module-info file. But when I create such a file, the apt-maven-plugin gets stucked on creating the Q-types. Has anyone successfully completed using Java 9 + Maven + Querydsl? My Maven configuration for the apt-maven

Collate hint on QueryDSL- JPA

拥有回忆 提交于 2021-01-27 07:14:46
问题 There is a way to execute it with QueryDSL? ( bold part ): SELECT * FROM Venue WHERE Name Like '%cafe%' COLLATE Latin1_general_CI_AI I am using JPA with hibernate. 回答1: You can use the addFlag(QueryFlag.Position position, String flag) method, documented here. Something similar to the following should do what you want: query.addFlag(QueryFlag.Position.END, "COLLATE Latin1_general_CI_AI"); In response to your question in the comments, if you require a solution that supports more than one

Collate hint on QueryDSL- JPA

淺唱寂寞╮ 提交于 2021-01-27 07:13:01
问题 There is a way to execute it with QueryDSL? ( bold part ): SELECT * FROM Venue WHERE Name Like '%cafe%' COLLATE Latin1_general_CI_AI I am using JPA with hibernate. 回答1: You can use the addFlag(QueryFlag.Position position, String flag) method, documented here. Something similar to the following should do what you want: query.addFlag(QueryFlag.Position.END, "COLLATE Latin1_general_CI_AI"); In response to your question in the comments, if you require a solution that supports more than one

How to use listagg with querydsl?

怎甘沉沦 提交于 2020-12-27 05:38:31
问题 I have a query as shown below; SELECT . . LISTAGG(DISTINCT CC.POPULATION, ', ') WITHIN GROUP (ORDER BY CC.POPULATION ASC), . . FROM COUNTRY C JOIN CITY CC ON C.ID = CC.COUNTRY_ID --WHERE GROUP BY C.ID; I should be implement with querydsl for custom filtering and sorting operations but I got "No pattern found for LISTAGG" error JPAQuery<Tuple> jpaQuery = jpaQueryFactory.select( SQLExpressions.listagg(QCity.city.POPULATION, ",") .withinGroup() .orderBy(QCity.city.POPULATION.asc()) ) .from

【ElasticSearch】:QueryDSL

佐手、 提交于 2020-12-16 16:04:39
Search API    URI Search    Response Body Search    Query DSL   Response Body Search使用Query DSL语句,相对URI Search功能更加灵活强大。   Query DSL是基于JSON定义的查询语言,主要包含如下2种类型:    Query DSL--字段类查询   term精确查询,match全文检索,range范围查询    Query DSL--字段类查询--match全文检索   match查询对输入文本分词后,做全文检索。          如果match多个单词,单词间空格分隔,是or关系查询       使用"operator":"and"来表示单词间是and关系查询       输入了多个单词,任意minimum_should_match个被匹配到就查询出来。    Qu ery DSL--字段类查询--match_phrase短语匹配    match_phrase短语匹配,查询确切的phrase,在对查询字段定义了分词器的情况下,会使用分词器对输入进行分词,然后返回满足下述两个条件的document:   1.match_phase中的所有term都出现在待查询字段之中。   2.待查询字段之中的所有term都必须和match_phase具有相同的顺序 。        

Bucket sort in composite aggregation?

跟風遠走 提交于 2020-12-13 03:15:44
问题 How can I do Bucket Sort in composite Aggregation? I need to do Composite Aggregation with Bucket sort. I have tried Sort with aggregation. I have tried composite aggregation. 回答1: I think this question, is in continuation to your previous question, so considered the same use case You need to use Bucket sort aggregation that is a parent pipeline aggregation which sorts the buckets of its parent multi-bucket aggregation. And please refer to this documentation on composite aggregation to know