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]
