比方说,我有这个实体(休眠):Hibernate:查询包含CollectionOfElements中指定元素的实体吗?
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id;
@CollectionOfElements
@IndexColumn("phones_index")
Set<String> phones;
}
例如,我想人的情况下,他们的手机包含“555-1234”。 我该如何对此进行查询?我在寻找类似的东西:
session.createCriteria(Person.class)./*something*/.add(Restrictions./*something*/"555-1234").list();
任何人都测试过它? – whiskeysierra 2010-01-10 13:53:10