Let's say I have this entity (for Hibernate):
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id;
@CollectionOfElements
@IndexColumn("phones_index")
Set<String> phones;
}
For example, I want to get instances of Person where their phones contain "555-1234". How can I do a query on this? I am looking for something similar to:
session.createCriteria(Person.class)./*something*/.add(Restrictions./*something*/"555-1234").list();