by Eabin 17 Mar 15:25
@OrderBy ignored?

Hi Rob,

Am I doing something wrong, or is this a bug (ebean 1.0.3):
class Comment:
@Column(name="cdate")
private UnixTimestamp creationDate;

class Event:
@OneToMany()
@OrderBy("creationDate") //tried cdate as well, no luck
@Where(clause="deleted=0")
private List comments;

When I enable debugging to console, no "order by" is ever logged.

regards,
-erwin

17 Mar 21:10
by Rob

Ok, I'll have a look at that...

18 Mar 12:09
by Rob

Ebean is using the order by when you query the master and detail in a single query.

However it is not using the order by ... when lazy loading the details. So I assume that is scenario where you hit this issue. Is that the case?

Aka you are doing:

//first fetch the Comment...
Comment comment = Ebean.find(Comment.class, 1)

//then lazy load the comments
comment.getComments().size();

Is that the scenario?

Thanks, Rob.

19 Mar 07:50
by Rob
19 Mar 19:53
by Eabin

sorry for replying late: yes that was the scenario. thanks as always for the quick response! very much appreciated.

Create a New Topic

Title:
Body:
 
Introduction User Guide (pdf) Install/Configure Public JavaDoc Whitepapers
General Database Specific Byte Code Deployment Annotations Features
Top Bugs Top Enhancements
woResponse