Необходимо извлекать записи из двух таблиц
Table1: KFT_M_CUSTOMER_CART_LIST
Table2: KFT_STATIC_DETAILS
Я попробовал этот SQL запрос, он работает в SQLserver
но этот запрос не работает в HQL
как писать в HQL-запросе
SELECT isnull(S1.VALUE,'') AS PRINT_MEDIUM ,
isnull(S2.VALUE,'') AS PRINT_QUALITY ,
isnull(S3.VALUE,'') AS PRINT_SIZE,
isnull(S4.VALUE,'') AS NO_OF_PRINTS
from KFT_M_CUSTOMER_CART_LIST M
LEFT JOIN [KFT_STATIC_DETAILS] S1 ON S1.MASTER_ID=100 AND S1.DETAIL_ID=M.PRINT_MEDIUM
LEFT JOIN [KFT_STATIC_DETAILS] S2 ON S2.MASTER_ID=200 AND S2.DETAIL_ID=M.PRINT_QUALITY
LEFT JOIN [KFT_STATIC_DETAILS] S3 ON S3.MASTER_ID=300 AND S3.DETAIL_ID=M.PRINT_SIZE
LEFT JOIN [KFT_STATIC_DETAILS] S4 ON S4.MASTER_ID=500 AND S4.DETAIL_ID=M.NO_OF_PRINTS
Класс сущности1: KftStaticDetail
@Column(name="MASTER_ID")
int masterId;
@Id
@Column(name="DETAIL_ID")
int detailId;
@Column(name="VALUE")
String value;
@Column(name="DESCRIPTION")
String description;
@Column(name="ACTIVE")
String active;
Класс сущности 2: KftCartItem
@Column(name="PRINT_MEDIUM")
private String printMedium;
@Column(name="PRINT_QUALITY")
private String printQuality;
@Column(name="PRINT_SIZE")
private String printSize;
@Column(name="NO_OF_PRINTS")
private int numberOfPrints;