Я адаптирую наши запросы SQL к hql, но столкнулся с препятствием, когда один из наших запросов использует функцию CONVERT ().Я не могу найти ничего об этом для hql в сети.
Запрос:
"SELECT tse.id, tse.ts_entries_ParentID As ParentID, tse.hours,
tse.project As projectID, (SELECT CONCAT(Project_Pastel_Prefix, ' - ', Project_Description) FROM Project WHERE Project_Code = tse.project) As 'projectName',
tse.task As taskID, (SELECT Budget FROM TimesheetCategories WHERE id = tse.task) As 'taskName',
tse.task As oldTaskID, (SELECT name FROM ts_tasks WHERE id = tse.task) As 'oldTaskName',
IF(STRCMP(tse.comment,'') = 0, (SELECT CONCAT(Project_Pastel_Prefix, ' - ', Project_Description) FROM Project WHERE Project_Code = tse.project), tse.comment) As 'text',
tse.user As userID, tse.customer As customerID,
concat(tsw.ts_working_hours_Date, ' ',tsw.ts_working_hours_Time_Start) As startDate, concat(tsw.ts_working_hours_Date, ' ',tsw.ts_working_hours_Time_End) As endDate,
CONVERT(1, UNSIGNED) As TypeId,
if(tsw.ts_working_hours_Date BETWEEN '1994-01-01' AND '2018-03-31', 2, 1) as TemplateID,
0 AS 'days',
0 AS 'isDoc',
'0' AS 'authorised',
tse.comment AS 'description',
0 AS 'leaveType',
0 AS 'isApproved'
FROM ts_entries tse, ts_working_hours tsw
WHERE tse.ts_entries_ParentID = tsw.ts_working_hours_ID
AND tse.user = :userID
AND tsw.ts_working_hours_Date BETWEEN ':startDate' AND ':endDate'