开发者

Create Hibernate criterion to select on property of property

开发者 https://www.devze.com 2023-03-16 16:36 出处:网络
I have two classes: class A { private B b; /* ... */ } class B开发者_运维问答 { private String c; /* ... */

I have two classes:

class A {
    private B b;
    /* ... */
}

class B开发者_运维问答 {
    private String c;
    /* ... */
}

Can I create a Hibernate criteria to select all A where b.c = "foo" ?


criteriaForA.createAlias("b", "b").add(Restrictions.eq("b.c", "valueForC");
0

精彩评论

暂无评论...
验证码 换一张
取 消