Defining Ordering of Service Entity Instances

Often, you want to retrieve multiple instances of a given entity and list them in a particular order. The service.xml file lets you specify the default order of your entities.

Suppose you want to return GuestbookEntry entities by their creation date. It’s easy to specify these default orderings:

<order>
    <order-column name="createDate" order-by="desc" />
</order>

You can enter asc or desc for ascending or descending order.

Now that you know how to order your service entities, the last thing to do is to define the finder methods for retrieving entity instances from the database.

« Defining Relationships Between Service EntitiesDefining Service Entity Finder Methods »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0