The Hibernate Annotations Reference says (in Table 2.1), that when mapping a relation with a java.util.List, List semantics will be used (instead of Bag semantics) if theres is EITHER an @OrderBy OR an @IndexColumn annotation.
But for this relation:
Code:
@OneToMany
@OrderBy(value="seqno")
public List<Child> getChildren() {
return children;
}
hibernate still applies Bag semantics. (PersistentBag).
When annotating with @IndexColumn
Code:
@OneToMany
@IndexColumn(name="seqno")
public List<Child> getChildren() {
return children;
}
Hibernate indeed uses List semantics (PersistentList).
I digged into org.hibernate.cfg.annotations.CollectionBinder, and indeed it looks like @OrderBy is only used to generate an SQL "order by", but has NO effect on List/Bag semantics.
Could sbdy please verify this?
Rgds,
M
My Versions:
* JBoss 4.0.4RC1
* Hibernate Annotations 3.1beta8
* Hibernate EntityManager 3.1beta6