Skip to content
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

Delegating collections create BeanPath extension #3327

Closed
edudar opened this issue Aug 2, 2022 · 1 comment
Closed

Delegating collections create BeanPath extension #3327

edudar opened this issue Aug 2, 2022 · 1 comment

Comments

@edudar
Copy link

edudar commented Aug 2, 2022

Using 5.0.0. JPA.

According to the docs, extending a class that has a Path class already should create a Q class that extends said Path class, like

public class QueryExtensions {
  @QueryDelegate(Date.class)
  public static BooleanExpression inPeriod(DatePath<Date> date, Pair<Date,Date> period){
     return date.goe(period.getFirst()).and(date.loe(period.getSecond()));
  }
}

public class QDate extends DatePath<java.sql.Date> {
}

http://querydsl.com/static/querydsl/5.0.0/reference/html/ch03s03.html#d0e2529

However, when I'm trying to extend a collection, like Set, QueryDSL creates BeanPath rendering other collection functions unusable:

public class SetFunctions {
  @QueryDelegate(Set.class)
  public static BooleanExpression isEmptyOrContains(SetPath<Object, ? extends SimpleExpression<Object>> field, Object value) {
    return field.isEmpty().or(field.contains(value));
  }
}

@Generated("com.querydsl.codegen.DefaultEmbeddableSerializer")
public class QSet extends BeanPath<Set<?>> {
  public BooleanExpression isEmptyOrContains(Object value) { ... }
}

This also results in class cast errors because generated QSet is not SetPath.

@stale
Copy link

stale bot commented Oct 20, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants