67,513
社区成员
发帖
与我相关
我的任务
分享
List list = sessionFactory.getCurrentSession().createQuery(
"select a.field2,b.field1 from Table1 a left join fetch Table1 b on a.field1 = b.field2 and a.field2 = '1'").list();
Iterator results = list.iterator();
while ( results.hasNext() ) {
Object[] row = (Object[]) results.next();
String field2 = (String) row[0];
String field1 = (String) row[1];
.....
}
select a.field2,b.field1 from A as a
left join B as b on a.field1 = b.field2 and a.field2 = '1';