这是我在oracle中的查询,但我希望用hibernate作为Generic
函数实现它,它将在整个应用程序中使用。然后我用谷歌搜索它并意识到hibernate不支持这种类型的查询。
--query in pl/sql
select *
from myTable t
start with t.id = 1
connect by prior t.id = t.parentid
public class MyModel {
Integer id;
MyModel parent;
// getter and setters
}
// suggested method signature
public <T> List<T> getByPrior(Integer startId) {
//return;
}
// and call it as you seen below
MyModel.getByPrior(1);
注意