I've been trying to get @OrderBy to work on a collection table of Strings.
Code:
@Entity
public class Employee {
@Id
@Column(name="EMP_ID")
private long id;
@ElementCollection
@CollectionTable(
name="PHONE",
joinColumns=@JoinColumn(name="OWNER_ID")
)
@Column(name="PHONE_NUMBER")
@OrderBy(value="phones")
private Set<String> phones;
}
This mapping doesn't seem to issue an 'order by' clause to the DB when loading the collection.
However, if I modify the collection to an Embeddable type, the SQL to load the collection will have an order by clause.
Am I missing something here? Is this the expected behavior or is this a bug ? I'm using hibernate 3.5.3-Final...