我正在阅读hibernate教程,并在博客中找到了一些示例。我试着理解下面的代码,请帮我以下代码...
Criteria criteria = session.createCriteria(Club.class,"club")
.createAlias("club.team","team")
.add(Restrictions.eq("club.name", "Arsenal"))
.add(Restrictions.eq("team.teamname", "Team A"));
List list = criteria.list();
原始SQL查询看起来..
select club.clubid, club.name, team.clubid, team.teamid, team.teamname
from Club club, Team team
where club.clubid=team.clubid and
club.name='Arsenal'
and team.teamname='Team A';
我的问题是:
Criteria criteria = session.createCriteria(Club.class,"club") - Alias for Entity
.createAlias("club.team","team") - ?
.add(Restrictions.eq("club.name", "Arsenal")) - name="Arsenal"
.add(Restrictions.eq("team.teamname", "Team A")); - teamname="Team A"
二线代码发生了什么?请指教..