Hi,
I'm having problem with the HQL query. I'm using MySQL.
This is my query:
Code:
select
o.uuid as uuid,
o.code as code,
o.title as title,
o.category.category as category,
o.priority.priority as priority,
o.difficulty.difficulty as difficulty,
o.type.type as type,
o.status.status as status,
o.status.color as recColor,
o.timeEstimate.description as timeEstimate,
o.date as date
from Task o
left join o.category
left join o.priority
left join o.difficulty
left join o.type
left join o.status
left join o.timeEstimate
this code produces following SQL:
Code:
select
task0_.uuid as col_0_0_,
task0_.code as col_1_0_,
task0_.title as col_2_0_,
taskcatego7_.category as col_3_0_,
taskpriori8_.priority as col_4_0_,
taskdiffic9_.difficulty as col_5_0_,
tasktype10_.type as col_6_0_,
taskstatus11_.status as col_7_0_,
taskstatus11_.color as col_8_0_,
tasktimedu13_.description as col_9_0_,
task0_.date as col_10_0_
from
Po_Task task0_ inner join Set_PersistentRecord task0_1_ on task0_.uuid=task0_1_.uuid
left outer join Po_SetTaskCategory taskcatego1_ on task0_.categoryUuid=taskcatego1_.uuid
left outer join Set_PersistentRecord taskcatego1_1_ on taskcatego1_.uuid=taskcatego1_1_.uuid
left outer join Po_SetTaskPriority taskpriori2_ on task0_.priorityUuid=taskpriori2_.uuid
left outer join Set_PersistentRecord taskpriori2_1_ on taskpriori2_.uuid=taskpriori2_1_.uuid
left outer join Po_SetTaskDifficulty taskdiffic3_ on task0_.difficultyUuid=taskdiffic3_.uuid
left outer join Set_PersistentRecord taskdiffic3_1_ on taskdiffic3_.uuid=taskdiffic3_1_.uuid
left outer join Po_SetTaskType tasktype4_ on task0_.typeUuid=tasktype4_.uuid
left outer join Set_PersistentRecord tasktype4_1_ on tasktype4_.uuid=tasktype4_1_.uuid
left outer join Po_SetTaskStatus taskstatus5_ on task0_.statusUuid=taskstatus5_.uuid
left outer join Set_PersistentRecord taskstatus5_1_ on taskstatus5_.uuid=taskstatus5_1_.uuid
left outer join Po_SetTaskTimeDuration tasktimedu6_ on task0_.timeEstimateUuid=tasktimedu6_.uuid
left outer join Set_PersistentRecord tasktimedu6_1_ on tasktimedu6_.uuid=tasktimedu6_1_.uuid,
Po_SetTaskCategory taskcatego7_ inner join Set_PersistentRecord taskcatego7_1_ on taskcatego7_.uuid=taskcatego7_1_.uuid,
Po_SetTaskPriority taskpriori8_ inner join Set_PersistentRecord taskpriori8_1_ on taskpriori8_.uuid=taskpriori8_1_.uuid,
Po_SetTaskDifficulty taskdiffic9_ inner join Set_PersistentRecord taskdiffic9_1_ on taskdiffic9_.uuid=taskdiffic9_1_.uuid,
Po_SetTaskType tasktype10_ inner join Set_PersistentRecord tasktype10_1_ on tasktype10_.uuid=tasktype10_1_.uuid,
Po_SetTaskStatus taskstatus11_ inner join Set_PersistentRecord taskstatus11_1_ on taskstatus11_.uuid=taskstatus11_1_.uuid,
Po_SetTaskTimeDuration tasktimedu13_ inner join Set_PersistentRecord tasktimedu13_1_ on tasktimedu13_.uuid=tasktimedu13_1_.uuid
where
task0_.categoryUuid=taskcatego7_.uuid and
task0_.priorityUuid=taskpriori8_.uuid and
task0_.difficultyUuid=taskdiffic9_.uuid and
task0_.typeUuid=tasktype10_.uuid and
task0_.statusUuid=taskstatus11_.uuid and
task0_.timeEstimateUuid=tasktimedu13_.uuid
TimeEstimate is not mandatory for the Task and can have null value. Now in my case no record is found as the generated code is
task0_.timeEstimateUuid=tasktimedu13_.uuidHow should I change HQL to get proper results?