英文:
How to generate Query classes when an entity extends a class from an external package that does not have support for QueryDsl?
问题
我有一个实体类如下:
public class Apple extends ExternalClass implements Serializable {}
这里的Apple
类继承了一个名为ExternalClass
的类,该类是外部包的一部分(不是项目源代码的一部分)。
当我尝试使用mvn compile
时,编译失败并显示以下错误:
> 错误: 找不到符号
> 符号: 类 QExternalClass
> 位置: 包 com.example.models
> public final com.example.models.ExternalClass _super = new com.example.models.ExternalClass(this);
我能想到的一个解决方案是将QueryDsl添加到外部包中,然后导入它。对于这个问题,还有其他解决方案吗?
英文:
I am having an entity class like below:
public class Apple extends ExternalClass implements Serializable {}
Here Apple
is extending a class ExternalClass
which is a part of a external package(not part of project source code).
When I am trying to use mvn compile, the compilation is failing with an error
> error: cannot find symbol
> symbol: class QExternalClass
> location: package com.example.models
> public final com.example.models.ExternalClass _super = new com.example.models.ExternalClass(this);
One solution that I can think of is to add QueryDsl to the external package, and then importing it. Is there any other solution available for this problem.
答案1
得分: 0
一种解决方法是在package-info
中添加@QueryEntities(value = {ExternalClass.class})
。
有关详细信息,请查看https://stackoverflow.com/questions/65111043/how-to-generate-query-dsl-q-classes-on-external-entity。
英文:
One solution is by adding @QueryEntities(value = {ExternalClass.class})
to package-info
.
For more details check https://stackoverflow.com/questions/65111043/how-to-generate-query-dsl-q-classes-on-external-entity
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论