Questions tagged [mysema]
16 questions
7
votes
3 answers
How to log the sql query generated behind the scene from querydsl using mysemma
Any optimal way to show sql queries which are generated automatically while using querydsl of mysemma, so that these sql queries can be viewed easily and debugging of sql query becomes easy while working on querydsl.
For Example :…

InvincibleCoder
- 123
- 1
- 6
7
votes
1 answer
QueryDSL group by hours in a time range
I have the following SQL query to group orders by the order date and hour in a day:
select to_char(o.order_date, 'YYYY-MM-DD HH24') order_date_hour,
sum(o.quantity) quantity
from orders o
where o.order_date >= to_date('01.02.2016', 'DD.MM.YYYY')
…

Robert M.
- 1,339
- 1
- 12
- 34
4
votes
2 answers
Junit, Mockito and Querydsl (Mysema) for mocking JPAQueryFactory
I am trying to set up an unit test for a method of an Spring Boot application that use Querydsl (Mysema) library.
The method to be tested include the following lines of code:
JPAQueryFactory queryFactory = new JPAQueryFactory(em);
QEntity q =…

Diego Cairone
- 93
- 4
- 10
4
votes
0 answers
Nested projection in QueryDSL (mysema)
I'm writing a query with mysqma.querydsl version 4.1.4, and I need to project a direct properties (attrs) and nested properties and some attrs of these nested properties, not all attrs.
I have a two Entities:
@Entity
@Table(name = "p_libro_visado",…

Cristian Rinaldi
- 329
- 4
- 15
4
votes
1 answer
How do I use SimpleExpression.eqAny in the mysema framework?
I'm looking at filtering in my query to return entities where locations intersects with the queries locations. From the method signature it seems that the eqAny method is the way to go.
The only downside is that it doesn't accept a collection, but…

iwein
- 25,788
- 10
- 70
- 111
2
votes
0 answers
Why is my move from com.mysema.querydsl package to com.querydsl having some issues?
I am trying to use the following method while using com.mysema.query package.
QueryDslRepositorySupport.getQuerydsl().applyPagination(pageable, query);
However, When I pass com.mysema.query.jpa.JPQLQuery object to the method, it complains that it…

Righto
- 855
- 3
- 11
- 32
2
votes
1 answer
QueryDSL, Spring Data: Select datetime between constant and database value with Predicate
Hi I would like to generate a Predicate for spring data QueryDSLRepository that would generate following query (or equivalent):
SELECT * FROM USER user JOIN PASSWORD_POLICY policy
ON
user.password_policy_oid = policy.password_policy_oid
WHERE
…

Piotr Tempes
- 1,091
- 1
- 12
- 26
1
vote
1 answer
Spring boot with querydsl problem with com.mysema.query.group.GroupBy
My Spring boot version :
2.3.1.RELEASE
1.8
and using query dsl like below
com.querydsl
querydsl-apt
…

umesh
- 155
- 1
- 9
1
vote
1 answer
JPAUpdateClause - is it possible to concatenate string values when setting values?
I'm using JPAUpdateClause to update all rows satisfying a BooleanExpression where clause.
BooleanExpression where = myEntity.id.isNotNull();
long updatedCount = update.where(where)
.set(myEntity.comments, request.getComment())
…

zmelvin
- 101
- 4
1
vote
0 answers
Querydsl StringExpression containsIgnoreCase encoding
I searched a lot for solution but i cannot find it. my problem is when i try to search persons name with containsIgnoreCase with turkish char 'İ' querydsl converts 'İ' to 'i ̇ ' i don't know how to solve this.
here is…

Utkan Ozyurek
- 638
- 7
- 20
0
votes
0 answers
Eclipse: Issue with apt-maven-plugin generating an "empty" class
I have a project that uses the com.mysema.maven:apt-maven-plugin:1.0.4 to automatically generate classes used for query-DSL.
The project builds fine with maven executed on the command-line.
However, when I build the same project within Eclipse the…

mmo
- 3,897
- 11
- 42
- 63
0
votes
0 answers
The right expression is not a valid expression when using replace in mysema query
The following works:
QTransaction.transaction.postingText.lower().like("%" + filter.getPostingText().toLowerCase() + "%"))
I am trying the similar query but replace x with u:
Expressions.stringTemplate("replace({0},'x','u')",…

Alex K.
- 220
- 3
- 10
0
votes
1 answer
JPAQuery to JPASubQuery and vice versa
Is there any way I can get a JPASubQuery from a JPAQueryand vice versa? I have a JPAQuery and I want to reuse it as a subquery but seems like there's not any kind of common interface between the two so that I can perform this transition. The query…

Niko
- 616
- 4
- 20
0
votes
0 answers
left join with nulls in jpa mysema query
Left join not retrive nulls
I need to get all records A when A.B.name like "%pac%" OR A.C.name like "%pac%"
Class entityClass = (Class) A.class;
PathBuilder entity = new PathBuilder(entityClass, "entity");
EntityManager…

Guido Valli
- 1
- 1
0
votes
0 answers
Mysema Querydsl - Enum to String
Example:
public enum ShapeType {
CIRCLE, SQUARE, RECTANGLE TRIANGLE
}
public ShapeEnity {
@Enumerated(EnumType.STRING)
private ShapeType shapeType;
.......
}
public ShapeDTO {
private String shapeType;
....
}
public…

Pablo
- 173
- 1
- 3
- 14