-->
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.  [ 1 post ] 
Author Message
 Post subject: sorting on a property which is a collection
PostPosted: Mon Mar 26, 2007 1:18 am 
Newbie

Joined: Thu Feb 08, 2007 5:10 pm
Posts: 4
Given the following model

public class Service {
private Long id;
private String name;
private List audiences;

....
}

public class Audience {
private Long id;
private String description;
private Provider service;
}


a portion of the service.hbm.xml file:

<bag name="audiences" lazy="false" table="SERVICE_AUDIENCE" >
<key column="serviceId" />
<many-to-many column="audienceId" class="Audience" />
</bag>

it is currently ordered by name, but i actually want to have a secondary odering by audiences which is a collection of some value objects for example:

AUDIENCE table
id description
1 junior
2 senior

SERVICE table
id name
1 service1
2 service2


SERVICE_TABLE
serviceId audienceId
1 1
2 2

how can i configure hibernate so that a collection of services can be first sorted by name and then by audience description?


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

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.