Hibernate-Java query

2

Hi, I'm working on hibernate and I do not know much about the subject and I'm trying to get a query in hql, but as much as I'm looking for how to do it I can not find the way since it's a multitasking query between charge, assignment_cargo_instructor and instructor and I arrive to a certain extent but the HQL Query console always sends me error this is the query in mysql

SELECT 'cargo'.'Nombre'
FROM 'cargo'
LEFT JOIN 'asignacion_cargo_instructor' ON 'asignacion_cargo_instructor'.'fkCodCargo' = 'cargo'.'CodCargo'
LEFT JOIN 'instructor' ON 'asignacion_cargo_instructor'.'fkIdInstructor' = 'instructor'.'Id'where instructor.idInstructor= idinstructor and instructor.ClaveInstructor=claveInstructor

and this is the query that I have in code hql

SELECT cargo.nombre
FROM Cargo
as cargo INNER JOIN   cargo.asignacionCargoInstructors ON AsignacionCargoInstructor.cargo = cargo.codCargo LEFT  JOIN   Instructor ON  asignacion_cargo_instructor.fkIdInstructor = instructor.id where instructor.idInstructor= idinstructor and instructor.ClaveInstructor=claveInstructor

It is not very different, but from where it is underlined it does not want to work anymore, it sends me error

org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'null.cargo'

I would like to know if someone could help me or pass me a good article that explains how to make these sentences

    
asked by Joe Diaz 09.08.2016 в 03:36
source

1 answer

0

The same error message tells you the problem:

  

org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path:   'null.cargo'

The value of: AsignacionCargoInstructor has a null value, check and ensure a correct value is obtained, this is so that your query is correctly constructed.

    
answered by 09.08.2016 / 13:36
source