-->
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.  [ 5 posts ] 
Author Message
 Post subject: Using order-by on collection
PostPosted: Fri Nov 14, 2003 12:51 pm 
Newbie

Joined: Fri Nov 14, 2003 12:23 pm
Posts: 2
Hello,
I can't seem to get the order-by property to work on my one-to-many collection. I am using XDoclet to generate my mapping files. Here is the relevant portion of the mapping:

Code:
        <set
            name="tags"
            lazy="true"
            inverse="true"
            cascade="delete"
            sort="unsorted"
            order-by="code asc"
        >

              <key
                  column="tag_type_id"
              />

              <one-to-many
                  class="com.mrs.multiview.persistent.Tag"
              />
        </set>


And here is the generated query when I initialize the associated collection:

Code:
2003-11-14 11:02:15,915 INFO  [STDOUT] Hibernate: select tags0_.tag_id as tag_id__, tags0_.tag_id as tag_id, tags0_.code as code, tags0_.is_active as is_active, tags0_.time as time, tags0_.tag_type_id as tag_type5_ from tags tags0_ where tags0_.tag_type_id=?


I am using Hibernate 2.1beta4 (also tried 2.0, but still no luck) with MySQL database.

Am I doing something wrong in the mapping?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 12:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
What JDK? LinkedHashSets are only avaiably under 1.4, IIRC.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 1:01 pm 
Newbie

Joined: Fri Nov 14, 2003 12:23 pm
Posts: 2
Sorry, forgot to mention I'm using JDK 1.4.2


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 8:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, I have no idea - I that your are not *really* using that mapping at runtime.

Try calling cfg.getCollection("foo.ClassName.tags").getOrderBy()


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 8:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
I that your



I mean "I guess that you're"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.