-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: @OrderBy does NOT force List semantics instead of Bag semant
PostPosted: Fri Apr 07, 2006 8:48 am 
Newbie

Joined: Tue Mar 28, 2006 4:03 pm
Posts: 11
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 16, 2006 12:14 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The doc is wrong, I've fixed it. thanks.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.