Plate

Take some pieces from a  various tables...

Would you like to read some parts of the tables without getting the whole ones?

Well... that's not a problem.

All you need to do, is to specify the columns, you want to read.

In case of two or more, Daobab would return a Plate object if you need a single row, or Plates as a collection of them.

Technically, Plate is a column wrapper.

It's not an Entity, but the general rule is the same - it's a wrapper for values related to particular columns.

In case of Entity - all columns belongs to a particular table and have an unique name.

Plate may contains columns with the same name and type and columns may belong to one or many different tables.

Plate has no dedicated getters and setters to a column values, where Entity has.

If you want to get some value, you need to use an universal getter to which you need to provide either a column object or at least a column name.

Plate has different structure. Entity is built on Column interfaces, and may have PrimaryKey for example.

Plate is a simple wrapper, where every column can be inside, that's why the class cannot inherits any particular column interfaces.

Plate internally has two level structure, with entity information at first level and column information at second.

Because of that, there is no problem with storing data related to columns with the same name and belonging to different entities.

You need to remember about those two levels in case of any conversion to JSON or XML for example.

If your set of columns is unique, you may remove entities information and use on column only. To do this, just convert Projection to FlatPlate, or call toFlat() method directly.

FlatPlat resolves the conversion issues. Your Plate converted to JSON looks like a typical DTO.


db.select(lower(t.colCountry()))
   .whereBetween(t.colID(), 10, 20) 
   .findMany();

© Copyright 2018-2023 Elephant Software Klaudiusz Wojtkowiak 
e-mail: contact@daobab.io