-1

是否可以像这个 SQL 查询一样加入 Hibernate SELECT t1.name FROM table t1 INNER JOIN table2 t2 ON t2.table1_id=t1.id;?例如:

class Table1Entity {
    public int id;
    public String name;
}

class Table2Entity {
    public int id;
    public Table1Entity table1Entity;
}

要使用 SQL选择所有table1entity使用过的,我将调用. 我知道我可以这样做,但我想使用 JOIN。table2entitySELECT t1.name FROM table t1 INNER JOIN table2 t2 ON t2.table1_id=t1.id;SELECT t1.name FROM Table1Entity t1, Table2Entity t2 WHERE t1.id=t2.table1Entity

4

1 回答 1

1
select t1 from Table2Entity t2 join t2.table1Entity t1
于 2013-11-02T10:36:06.050 回答