tx = session.beginTransaction(); List results=session.find("from HourlyEmployee"); tx.commit(); return results; 在运行Session的find()方法时,Hibernate执行以下select语句: select * from HOURLY_EMPLOYEES he inner join EMPLOYEES e on he.EMPLOYEE_ID=e.ID; select * from COMPANIES where ID=1;
tx = session.beginTransaction(); List results=session.find("from Employee"); tx.commit(); return results; 在运行Session的find()方法时,Hibernate执行以下select语句: select * from EMPLOYEES e left outer join HOURLY_EMPLOYEES he on e.ID=he.EMPLOYEE_ID left outer join SALARIED_EMPLOYEES se on e.ID=se.EMPLOYEE_ID; select * from COMPANIES where ID=1;