Getting started
Suppose you have a relational database for saving books, and there exists the Books table with the following schema:
Column
Type
title
String
author
String
genre
String
release_date
DateTime
To filter books by the author Svetlana Isakova we need to create a Criteria
instance adding a filter by the author
field.
If we want to sort the result to get the most recent released books we can add an orderBy
clause.
Also we can define a FieldMap
for hide the real field names by other one. For example, we can filter by author
field referencing it as author_name
. (See more about FieldMap
on next steps)
To run a query using our Criteria
we need to adapt it to our favorite database driver or ORM.
Next steps
Last updated