Thanks for your reply !

but 
when i execute a query, such as 

roleManager.getAll();

return a list of Role.

the list is not the property of some other entity

how to sort this kind of list by configuration ?





chinofish
2007-07-27



发件人: Trent
发送时间: 2007-07-27 11:19:42
收件人: [email protected]
抄送: 
主题: Re: [appfuse-user] sort of list

On Fri, 27 Jul 2007 10:27:33 +0800, chinofish wrote
> when execute 
> dao.getAll();
> 
> system will return a list.
> 
> how to sort the list just by configuration (without writing a line ?)

From
http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html

By default, a JPA persistence provider retrieves the members of a Collection
association in ascending order by primary key of the associated entities.

Use the @OrderBy annotation with @OneToMany and @ManyToMany to specify:
    *one or more other field or property names to order by
    *different orders (ascending or descending) for each such field or
property names

Example: 
    @ManyToMany
    @OrderBy("lastname ASC", "seniority DESC")
    public List <Employee > getEmployees() { ... }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to