如何在实体继承来自不支持QueryDsl的外部包的类时生成查询类?

huangapple go评论66阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年2月8日 19:46:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/75385352.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定