Hi !
Here is my mapping:
@Entity
public class Contact {
public enum TypeSynthese {one, two, three};
@CollectionOfElements
@JoinTable(name="contact_synthese", joinColumns = @JoinColumn(name="contact_id"))
@Column(name="synthese_id", nullable=false)
@Enumerated(EnumType.STRING)
private Set<TypeSynthese> syntheses;
}
I would like to select all contacts which syntheses' Collection contains two.
from Contact c where c.syntheses = two doesn't work.
from Contact c where two in (c.syntheses) doesn't work either.
from Contact c where two in elements(c.syntheses) works but generates an ugly subselect, a join would be nicer.
Is it possible ?
Thanks
Hibernate version: : 3.2.5
|