Note that there are some explanatory texts on larger screens.

plurals
  1. PO@OneToOne JPA Hibernate Exception - could not resolve property
    text
    copied!<p>I new in Hibernate, I tried do a relationship one to one but show this error:</p> <pre><code>org.hibernate.QueryException: could not resolve property: Grupos of: com.seguridad.modelos.Empleados [ from com.seguridad.modelos.Empleados e left join e.Grupos g where e.idJefe=:supervisor order by nombre] </code></pre> <p>I have two tables: Empleados and Grupos like this:</p> <blockquote> <p>Table Empleoyess:</p> <blockquote> <p>idEmpleado (key) | nombre | aPat | aMat | grupo</p> </blockquote> <p>Table Grupos</p> <blockquote> <p>id (key) | nombre | fecha |</p> </blockquote> </blockquote> <p>The relation bewteen in Empleados(Empleoyess) and Grupos(Groups) is Empleados.grupo = Grupos.id</p> <h1>Empleoyess.java</h1> <pre><code> @Entity() @Table(name="empleados") @org.hibernate.annotations.Entity(dynamicUpdate = true) public class Empleados implements Serializable { private String nombre; private String aPat; private String aMat; @Column(name="grupo") private Integer idGrupo; @OneToOne @JoinColumn(name = "id",insertable = false, updatable = false) private Grupos grupos; //GETTER AND SETTERS } </code></pre> <h1>Grupos.java</h1> <pre><code>@Entity() @Table(name="grupos") public class Grupos implements Serializable { @Id @GeneratedValue private Long id; private String nombre; @Temporal(javax.persistence.TemporalType.TIMESTAMP) private Date fecha; //GETTER AND SETTERS } </code></pre> <p>This is my query </p> <blockquote> <p>from com.seguridad.modelos.Empleados e left join e.Grupos g where e.idJefe = 5</p> </blockquote> <p>and show the error before , but if I try :</p> <blockquote> <p>from Empleados e, Grupos g where e. idJefe=5 and e.idGrupo=g.id order by e.nombre</p> </blockquote> <p>is sucessful, I can´t understand where is the error, others posts tell about syntax, but I believe my syntax is correct</p> <p>Regards and thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload