Daobab Entity is an object having some fields inside.
For database usage, it represents a table having columns.
Each unique column has its own, unique interface.
And Entity inherites such interfaces.
This is how relations between tables are recreated into Daobab Entities.
If Entity does not inherits particular column interface, this column remains invisible, and values cannot be read or write.
Entity as a class is very poor. Except implementation of many interfaces containing a table name information and a map inside.
Whole data is stored into a map, through interfaces.
Entity used externally, becomes very rich and provides a lot of useful methods like:
- getters and chained setters
- conversion to JSON
- proper hashcode and equals
Moreover, if table has Primary Key, PrimaryKey interface is added. A lot of useful methods becomes available.
Entity also has a column() method, which returns all column interfaces.
It's not enough to add new interface, when a new column is added into a table. Remember to point to a new column into this method as well.
Entity may be protected via Optimistic Concurrency Control. Also by implementing special interface only.
For special cases, Entity may be upgraded with ExtendedEntity interface.
Check out another DataTypes