问题
I have 2 entities whose extracts are like these:
public class Visita {
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="pdv_uid")
private PuntoDeVenta pdv;
}
public class PuntoDeVenta {
private Integer idclient;
private String zona;
@ManyToOne
@JoinColumn(name="pdv_categoria_uid", nullable=true)
private PuntoDeVentaCategoria categoria;
}
public class PuntoDeVentaCategoria {
private String descripcion;
}
I try to do restrictions with the differents fields and some of them work, some of them don't.
With this root criteria:
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Visita.class).createAlias("pdv", "pdv");
I try to make restrictions with the differents fields of "PuntoDeVenta" and "PuntoDeVentaCategoria" (with and without the createAlias) and I get the exception "could not resolve property", for example:
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Visita.class).createAlias("pdv", "pdv").add(Restrictions.eq("pdv.categoria.descripcion", "example"));
I've researching and I didn't found anything for my case.
Thank you in advance
来源:https://stackoverflow.com/questions/26176915/could-not-resolve-property-hibernate