java - Inner Joins in HQL -
i'm unable execute hql command:
string hql = "select t.ticketname, t.idticket, d.jour ticket t inner join datetraitement d on d.idticket=t.idticket t.idticket= 1"; query query = getsession().createquery(hql) ; list<abc> result = query.list();
i have error : org.hibernate.queryexception: not resolve property: idticket of: m.m.model.datetraitement [select t.ticketname, t.idticket, d.jour m.m.model.datetraitement d, m.m.model.ticket t d.idticket = t.idticket]
here datetreatment class:
enter code here
private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) @column(name = "id_date_traitement", unique = true, nullable = false) private integer iddatetrait; @column(name = "jour", length = 50) private int jour; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "id_ticket") private ticket ticket; public integer getiddatetrait() { return iddatetrait; } public void setiddatetrait(integer iddatetrait) { this.iddatetrait = iddatetrait; } public int getjour() { return jour; } public void setjour(int jour) { this.jour = jour; } public ticket getticket() { return ticket; } public void setticket(ticket ticket) { this.ticket = ticket; }
}
i don't know i'm missing. appreciated.
try this: updated after new question:
string hql = "select d.ticket.ticketname, d.ticket.idticket, d.jour datetraitment d d.ticket.idticket = 1"; query query = getsession().createquery(hql) ; list<abc> result = query.list();
Comments
Post a Comment