Make The Complex Queries Easy

Make the easy trivial, using DBQuery

DBQuery Makes Harder Queries Trivial

Retreive data from multiple tables using the DBQuery object. Create your DBQuery using DBDatabase's convenient getDBQuery(DBRow....) method:

DBQuery dbQuery = database.getDBQuery(marque, new CarCompany());

DBQuery provides methods to add required and optional ("OUTER") tables, limit the rows returns, sort the rows on the database, allow blank queries, and even allow cartesian joins. There are also methods to automatically add all the tables related to the query

dbQuery.addOptional(new Vehicle());
List<DBQueryRow> allQueryRows = dbQuery.getAllRows();
List<Marque> allMarques = dbQuery.getAllInstancesOf(marque);

Using a DBQuery instance allows you to retrieve all instances of a DBRow quickly without scrolling through all the DBQueryRows. Just call getAllInstancesOf(DBRow) to retrieve a list of each instance. This quickly converts a long query to a small number of distinct objects

dbQuery.add(DBRow.... ) adds more tables to the query as required tables. addOptional(DBRow.... ) adds the tables but uses outer join syntax. All DBRow objects can be added as optional and a full outer join will be performed

Use Recursive Queries to Find Your Boss's Bosses

When a table has a foreign key to itself, DBvolution makes it easy to follow the implied hierarchy. DBRecursiveQuery provides methods to find the path to the top of the hierarchy, or a produce a tree of the entire hierarchy.

DBRecursiveQuery recursive = new DBRecursiveQuery(staffQuery, employee.column(employee.manager));
List managers = recursive.getAncestors();

... and Your Staff

DBRecursiveQuery recursive = new DBRecursiveQuery(managerQuery, employee.column(employee.manager));
List staff = recursive.getDescendants();

When you want DB to be easier and faster...

Get DBvolution from GitHub or Maven

DBvolution is the gateway to your database and high-speed querying
  Contact us now for details
  +64 27 444 5201
Support us on Patreon