-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MapPath problem with JPA / Hibernate in v4.1.3 #1999
Comments
Generated SQL is a tough issue in Querydsl JPA, but we'll see if it's something on our end, on Hibernate's end or your query. Could you maybe post our generated JPQL? Did you already make aliases when joining? For containsKey we join to the property's parent BooleanBuilder where = new BooleanBuilder();
for (WorkMode mode : modes) {
where.or(myEntity.workByMode.containsKey(mode));
// ^ ^ ^ ^ ^ ^ ^
// maybe use an alias here?
} Maybe we need to see more of the query, is that possible? |
Here's more detail the WorkShiftStatistics Entity
the query builder
the output sql
If you need to take the issue somewhere, I could try to set up a test project but probably not this week... |
Could you please post the JPQL? I think I see what is wrong (we might not reuse generated aliases correctly?), but to confirm my theory I need the JPQL that we generate. |
This is the log output, is this what you need?
|
Querydsl doesn't provide DSL alternatives for the JPQL KEY operator, but you can use it manually like this instead of map.containsKey(...):
|
I have a strange problem with a MapPath mapping. I don't know if it's something on my side, so I'm posting it here (sorry for using quotes instead of code, it was not formatting as it should for some reason!)
I have this kind of mapping:
When I try to filter a query with the map keys, allowing to have one of multiple values using a boolean builder:
The SQL that ends up being generated has a left outer join with WorkByMode (which is great) but then an inner join with WorkMode
So if I only have one of the given keys, the second inner join makes the result empty... if it were a left join it wouldn't.
I don't know if other sql engines use another precedence, but I'm using sqlserver and this is not working.
Is it me? Can I avoid the second inner join somehow?
The text was updated successfully, but these errors were encountered: