Questions mount as a criteria where I join an object outside of the object what to do?
I'm trying to do a query using criteria where my class master
Criteria criteria = session.createCriteria (EstoqueItem, EstoqueItem);
and try to get all the records where the field name EstoqueItem
the object model equal "LG"
but is giving me error:
[code]
between creating an alias but no model of the object EstoqueItem what to do ?????
Criteria criteria = session.createCriteria (EstoqueItem, EstoqueItem);
if (detail.getColumn (). equals ( "name")) (
criteria.createCriteria ( "device", "device");
/ / Device X Stock Item
criteria.add (Restrictions.eqProperty ( "device" +. "id", classTableMaster.getSimpleName (). toLowerCase ()+". device "));
/ / Device device_model X
criteria.add (Restrictions.eqProperty ( "device" + ". model", detail.getClassTableName ()+". id "));
/ / value of the object model atr
criteria.add (Restrictions.eq (detail.getClassTableName ()+"."+ detail.getColumn (), detail.getValue ()));
)
= Org.hibernate.QueryException Error: could not resolve property: model of: br.com.EstoqueItem
[/ code]
[code]
class EstoqueItem (
private int id
private Device device;
)
class Device (
private int id;
private Model model;
)
class Template (
private int id;
private String name;
)
[/ code]
|