hibernate查询数据库
例如Person表连接Adress表,Person表中的adressid与Adress表中的主键是多对一关系
Person的hibernate.xml配置如下:
问题是:我要根据Adress表中的其他属性(如:adress.name)作为条件来查询Person表对应的数据。
(代码:dc=xxx.xxx(Person.class);
dc.add(xxx.ilike("adress.name","%xxx%"));
dao.find(dc);)
报错:could not solove : adress.name of (xx.xx.Person)
(我想应该是hibernate根据xml配置生成sql语句时,没有按照想要的sql,就是 from person join adress where adress.name=xx)
菜鸟真心求解释,谢谢!