Skip to content

Difficult handling of QueryDSL classes with the JPMS #3353

@CybAtax

Description

@CybAtax

When trying to use the JPMS with a Spring Boot application that uses QueryDSL classes, certain issues may arise. When QueryDSL classes are required for classes that are defined outside of the working module, a split-package error will occur, as the package of the QueryDSL class will already exist in the referenced module.

When trying to generate the classes into a "subpackage" (which will then reside in the current working module) the EntityPathResolver does not appear to work properly - as the base Implementation SimpleEntityPathResolver by default only attempts to load the Q-class from the same package as the entity resides in - despite already providing a field "querySuffix" to be able to handle such a field.

Overriding of course works, but as it is no bean the override is required at a level, where the EntityPathResolver is referenced. As that is not a Bean however, the override is required to go up (several) levels to properly work (cf. https://stackoverflow.com/questions/47771175/how-to-register-custom-querydsl-entitypathresolver-with-spring-data-mongoreposit)

From a user perspective this seems a rather laborious approach. A preferred approach for better JPMS support to me would be the availability of a Bean to be overriden for the EntityPathResolver or even simpler a property to be able to configure the querySuffix. This would suffice for me - however I could imagine a future requirement for other configurations of QueryDSL class generation such as the APT options listed in http://querydsl.com/static/querydsl/latest/reference/html/ch03s03.html -> 3.2 APT options

An example project outlining the issue can be found at https://github.com/CybAtax/qdsl-subpackage-demo

Once a desired solution was discussed, I will gladly help with implementation

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions