Search Results

Search found 1 results on 1 pages for 'jrsokolow'.

Page 1/1 | 1 

  • hibernate criteria OneToMany, ManyToOne and List

    - by jrsokolow
    Hi, I have three entities ClassA, ClassB and ClassC. ClassA { ... @Id @GeneratedValue @Column(name = "a_id") private long id; ... @OneToMany(cascade={CascadeType.ALL}) @JoinColumn(name="a_id") private List<ClassB> bbb; ... } ClassB { ... @ManyToOne private ClassC ccc; ... } ClassC { ... private String name; ... } I want to filter by hibernate criteria ClassA by 'name' member of ClassC. So I want to obtain by hibernate criteria list of ClassA objects which have inside ClassC objects with specified name. Problem is that access to ClassC objects is through ClassB list. I tried something like this but it does not work: crit.createCriteria("bbb").createCriteria("ccc").add(Restrictions.ilike("name", name, MatchMode.ANYWHERE)); I will be grateful for help.

    Read the article

1