I am facing a problem in hibernate property formula field. Not able to combine both table columns.
shift_id column belongs to parent table of job_card and duration column belongs to child table of job_card_idle_time.
but it consider both columns are belongs to parent table of job_card.
<property
name="utilization"
formula="(count(shift_id)*340)-sum(duration)/(count(shift_id)*340)"
generated="never"
insert="false"
update="false"
type="float">
</property>
With the resulting query:
select (count(this_.shift_id)*340)-sum(**this_.duration**) /(count(this_.shift_id)*340) as y0_,
this_.JOB_CARD_DATE as y1_
from job_card this_
left outer join job_card_idle_time ir1_ on this_.JOB_CARD_ID=ir1_.JOB_CARD_ID
where this_.JOB_CARD_DATE between ? and ?
group by this_.JOB_CARD_DATE
order by this_.JOB_CARD_DATE desc
i want it as,
select (count(this_.shift_id)*340)-sum(**ir1_.duration**)
/(count(this_.shift_id)*340) as y0_,
this_.JOB_CARD_DATE as y1_
from job_card this_
left outer join job_card_idle_time ir1_ on this_.JOB_CARD_ID=ir1_.JOB_CARD_ID
where this_.JOB_CARD_DATE between ? and ?
group by this_.JOB_CARD_DATE
order by this_.JOB_CARD_DATE desc
How do i achieve it?