byond
String sql="select {e.*},{d.*}from EMP e join DEPT d on d.DEPTNO=e.DEPTNO"
+"where e.JOB=:job";//创建员工表和部门表的原生sql
Query query=session.createSQLQuery.addEntity("e".Emp.class)
.addJoin("d","e.dept").setString("job","saler");//添加内连接
List<Object[]> list=query.list();//查询返回list
Emp emp=null;//实例化实体对象
Dept dept=null;
for(Object[] obj:list){//用反射组装查询结果
emp=(Emp)obj[o];
dept=(Dept)obj[1];
system.out.print(emp.getEmpName+","+dept.getDeptName);//输出内容
}