Hi,
one way of doing this is to create an intermediate entity which you use to create a link between
Foo and
Group. This type of mapping was just recently discussed here
http://forum.hibernate.org/viewtopic.php?t=987912.
One you have such an intermediate entity say
FooGroupLink you should be able to use the @OrderBy annotation on your
foosInGroup property:
Code:
@OneToMany(mappedBy="group")
@OrderBy("order_index")
public List<FooGroupLink> getFooGroupLinks() {
return FooGroupLinks;
}
Another alternative would be to use to map the joint table ot a collection of components. This approach is described in "Java Persistence with Hibernate". The idea stays the same though. You need an intermediate 'entity'
FooGroupLink which in this case is embeddable.
Hope this helps,
--Hardy