我找不到关于如何处理这种情况的任何文件。我一直收到以下错误:
org.hibernate.QueryException: could not resolve property: id_alumno_origen
of: dm.model.tramite.TrasladoInterno
....
antlr.SemanticException: Path expected for join!
我使用以下查询,虽然我找到了一些解决方案,指的是JOIN + ON
情况下缺少对字段的引用,但我没有运气:
from pe.edu.innovaschools.dm.model.tramite.TrasladoInterno a
JOIN gen_sede b ON b.id = a.id_sede_destino
JOIN aca_grado c ON a.id_grado_destino = c.id
WHERE a.tipo = 'INTERPERIODO'
AND a.estado IN ('ACEP' , 'PEND')
AND a.id_periodo_origen = :PERIODOORIG
AND a.id_periodo_destino = :PERIODODEST
GROUP BY a.id_sede_destino , b.nombre , a.id_grado_destino , c.nombre_ps , a.estado
答案 0 :(得分:0)
在HQL
上我更喜欢使用隐式JOIN表示法(更多次显式JOIN
会导致错误)。
如果您使用GROUP BY
,则必须对SELECT
应用投影,请尝试以下操作:
select a.id_sede_destino, b.nombre,
a.id_grado_destino , c.nombre_ps , a.estado
from pe.edu.innovaschools.dm.model.tramite.TrasladoInterno a,
gen_sede b,
aca_grado c
WHERE b.id = a.id_sede_destino
AND a.tipo = 'INTERPERIODO'
AND a.id_grado_destino = c.id
AND a.estado IN ('ACEP' , 'PEND')
AND a.id_periodo_origen = :PERIODOORIG
AND a.id_periodo_destino = :PERIODODEST
GROUP BY a.id_sede_destino, b.nombre,
a.id_grado_destino , c.nombre_ps , a.estado