JPQL HQL查询在类层次结构之上运行,具有连接的继承策略并应用DTO投影

问题描述

鉴于我有以下具有继承策略的类层次结构:

1234heh

如何编写JPQL / HQL查询,该查询将返回@Entity @Inheritance(strategy = InheritanceType.JOINED) public abstract class Notification { protected Long id; protected Long code; protected Notification() { } } @Entity @PrimaryKeyJoinColumn(name = "NOTIFICATION_ID") public class Sms extends Notification { private String phoneNumber; private String smsText; public Sms() { } } @Entity @PrimaryKeyJoinColumn(name = "NOTIFICATION_ID") public class Push extends Notification { private String application; private String pushText; public Push() { } } ,其中List<NotificationDetails>是:

NotificationDetails

其中的映射应如下所示:

public class NotificationDetails {

    private final String contact;
    private final String content;

    public NotificationDetails(String contact,String content) {
        this.contact = contact;
        this.content = content;
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)