Hi,
I have two tables related with one - to - many association (One Invoice can have many Invoice States).
INVOICE (invoiceNum(PK),amount, date) and INVOICE_STATE (id(PK),invoiceNum, type, value)
The join is based on invoiceNum. I need all the invoices from table Invoice having type = "INVACC" and value = "2BP".
I tried following but i get all the results :(
Code:
return getSession().createCriteria(Invoice.class).createCriteria("invoiceStateList", "state").add(
Expression.eq("state.type", "INVACC")).add(
Expression.eq("state.value", "2BP")).list();
Please help.