Skip to main content
You are not a member of this wiki.
Pages and Files
What is a DB API?
For the project that have database, a common recommended way to access it is to use a Data Access Object layer. This DAO layer is used to wrap the complexity of accessing the database data and protocol by façaded the access with an interface operating with objects.
If we look a little closer what are the functionalities this layer will provide to the users, we can classified those in two distinct categories:
Entity (table) specific functions. Generally associated with CRUD functions;
Business related functions. Ex: special select, access to store proc...
Developing the entity specific functions of a DAO layer is a tedious task:
error prone, lots of places to maintain in case of changes in the model;
most of the code developped is linked with the database model and has little with the business added value.
helps the developer by generating the model's DB API which is a default API for a data model.
generates a default DAO layer for the model with CRUD+ functionalities.
search on Example/Prototype;
update on Example/Prototype;
partial Load of data;
Loads just couple of fields of a entity or its associated parents
load part of the object graph;
This API is easy to integrate: Service can be quickly be build on the top of it.
This API is easy to extend:
Other DAO using partially or completely the generated code can be quickly developed;
Extension on top of ORM maps are also feasible. The user can use the mappings to write his/her specific queries.
DB API available methods
Are used for indicating which field is to be taken into account. Domain Object mask specifies the fields corresponding to database column with no null value.
Those non-null field can be further processed according to the contect (DAO method) there are used.
a mask can indicate the field to
1) retrieve (or the opposite not to retrieve) on a table, and thus create the correct sql statement.
2) set to null (or the opposite not empty) in a where clause.
In the context of BSLA DAO layer.
A positive bean is a mask, used for where clause, whose non-null attributes are to be used by the DAO method to express the value to use in the query.
A negative bean is a mask, used for where clause, whose non-null attributes are to be used by the DAO method to express which field are null to use in a query.
What and Where parts
Simple Domain Object
Domain Object With Parents
search on prototype
Based on a positive bean:
Return a list of Domain Object that matches the criteria passed in the Domain Object positive bean.
Get all employees that have the name 'ADAM'.
Based on positive and negative beans:
Return a list of Domain Object that matches the criteria passed in the Domain Object positive bean and null criteria that are set in the negative bean mask.
get all employees where that are still present (where the departure date is empty).
delete / update on prototype
exists where conditions are
partial load with parent
assign use cache
affect use cache
search distinct on prototypes
help on how to format text
Turn off "Getting Started"