Hibernate Criteria API - adding a criterion: string should be in collection

后端 未结 7 1748
北恋
北恋 2020-12-16 06:05

I have to following entity object


@Entity
public class Foobar {
    ...
    private List uuids;
    ...
}

Now I\'d like to

7条回答
  •  生来不讨喜
    2020-12-16 06:22

    You could use a Query as in the example below or you could convert this to a NamedQuery. Unfortunately there doesn't seem to be a way to do this with Criteria.

    List result = session
         .createQuery("from Foobar f join f.uuids u where u =: mytest")
         .setString("mytest", "acb123")
         .list();
    

提交回复
热议问题