querydsl

QueryDSL for Mongo with Spring and gradle

我的梦境 提交于 2019-12-11 00:31:16
问题 How do I generate the predicate classes (Q* classes) with gradle? I want to use Q* classes for Mongo using Spring data. Spring documentation shows maven and ant versions but no gradle. Is there any plugin out there that I could use? 回答1: You can use the same approach is presented here Generating JPA2 Metamodel from a Gradle build script Just replace the Querydsl JPA APT processor with the Spring Mongodb processor. 回答2: There is an example in my project: spring-data-demo You will need to

Maven apt-get-plugin for mysema

限于喜欢 提交于 2019-12-10 21:10:18
问题 I have added following snippet in my pom.xml, but in eclipse the execution part is error saying: Plugin execution not covered by lifecycle configuration: com.mysema.maven:maven-apt-plugin:1.0.3:process (execution: default, phase: generate-sources) Though when I am running mvn clean install from command line it is working properly then. <build> <plugins> <plugin> <groupId>com.mysema.maven</groupId> <artifactId>maven-apt-plugin</artifactId> <version>1.0.3</version> <executions> <execution>

How to use Query DSL with MongoDB in Spring Boot

不想你离开。 提交于 2019-12-10 20:05:57
问题 I try to use Query DSL with MongoDB in Spring Boot and I get an error. The app is working successfully without using the library for Query DSL for MongoDB. And I want to use this library because I want to use more complex queries. The code should work, I think there is a little mistake somewhere. The problem is when I click Maven package I get these errors, unfortunatelly I can't post all the output here: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean

QueryDSL JPA syntax error with contains on Set?

别说谁变了你拦得住时间么 提交于 2019-12-10 16:43:59
问题 I have a JPA entity bean similar to the following: @Entity class License { @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "LicenseTags") Set<Tag> tags; // Skipped remaining members } Tag itself is also an Entity with an id and a name. Now I want to query for licenses that have certain tags attached to them. When I try the following query Set<Tag> tags = ...; final QLicense license = QLicense.license; JPAQuery q = new JPAQuery(entityManager).from(license); for (Tag tag : tags) { q

querydsl 3.3.0 - using collection.any() with elementcollections in a query with N boolean arguments generates N “exists” sub-queries

有些话、适合烂在心里 提交于 2019-12-10 16:11:02
问题 I am attempting to query for a specific item in an ElementCollection that matches 2 criteria. When I write the query in QueryDSL, the query generated by Hibernate includes 2 exists statements with subqueries, each subquery contains 1 of the criterion I specified. Here is an example: @Entity public class Person { @Id private Integer id; } @Entity public class Project { @Id private Integer id; private boolean canned; @ElementCollection(fetch=FetchType.EAGER, targetClass=ProjectMember.class)

[QueryDSL/Spring]java.lang.IllegalStateException: Connection is not transactional

我们两清 提交于 2019-12-10 15:44:56
问题 I writing Spring+Vaadin application. I wanted to add QueryDSL to access db (Oracle). I looked in documentation (http://docs.spring.io/spring-data/jdbc/docs/current/reference/html/core.querydsl.html) and I read that Spring recommend using standard QueryDSL api. I improted to my project following dependecies: <dependency> <groupId>com.mysema.querydsl</groupId> <artifactId>querydsl-sql-spring</artifactId> <version>${querydsl.version}</version> </dependency> <dependency> <groupId>org

QueryDSL: join subquery

﹥>﹥吖頭↗ 提交于 2019-12-10 09:25:18
问题 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 回答1: 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

querydsl transformer group by count

女生的网名这么多〃 提交于 2019-12-10 03:41:36
问题 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? 回答1:

How to left join unrelated entities?

蓝咒 提交于 2019-12-10 02:30:48
问题 When i try to run a query like this: QA A = QA.a; QB B = QB.b; ... from(A) .leftJoin(B).with(B.name.eq(A.nameSomething)); (A and B entities are not related) I'm always getting this error: Caused by: org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! I would like to be able to left join unrelated entities using querydsl. Is it possible at all? Or the only way is to write a native Oracle query? 回答1: Joining unrelated entities is not possible with Querydsl JPA. Querydsl JPA uses

QueryDSL and Play Framework

泪湿孤枕 提交于 2019-12-09 00:18:40
问题 I'm using QueryDSL with JPA2 for some time, and it's the most powerful combination for ORM I know. JPA Criteria API is a disaster. With QueryDSL I've forgotten about JPQL too. I'd like to use QueryDSL with Play! Everything looks very good in Play except those inline parts of JPQL as strings. It reminds me of CakePHP... I'd like to have refactoring-proof querying language in Play (and some other things :) ). QueryDSL usage would be straightforward. It needs EntityManager only. But QueryDSL has