Reputation: 7647
Does the domain layer and the persistence layer refer to same or are they different. Domain layer is the DAO's which we usually map to database tables right? so does persistence layer means the same or is there more?
And if we are calling the POJO's which map to database tables as DAO's, what we say the classes which resides the execution of queries and populate those DAO's (POJOS).
What is the best practice? Keeping the query execution code inside those POJO's or make them a separate class? i mean example suppose A is the class map to database table A. Do we need to implement separate class like ADaoImpl for place the query related code need for class A? i belive its not right? isnt it the best practice keep all the DAO objects populating, query executions etc related to all DAO classes in a single class called something RDBMSDaoImpl. so we called that class a DAO Implementation class of out application which belongs to the DAO layer right?
So as a summary the POJOS(DAO) and DAOImpl is the DAO layer of our application right? and the persistence layer is..?
Thanks.
Upvotes: 6
Views: 10213
Reputation: 4015
The domain layer is where you model your objects and application features. If you are building an Invoicing application the domain layer should contain the Invoice, Vat and InvoiceItem objects for example. The DAO layer is responsible for retrieving and saving objects from your storage (RDMS database, NoSQL database, etc). In your code, you could have something like
public InvoiceDao {
public void insert(Invoice invoice) {
//use your database api to insert invoice
}
}
Upvotes: 2
Reputation: 76
1- persistence layer : is the layer that deal with the database, it consist of a set of classes that maps the database and all operation on that table. summery: you separate database from business layer. 2- business(DAL) : initiate (create) objects form classes that existing in persistence layer.
Upvotes: 1
Reputation: 597342
Wikipedia: "A business logic layer (BLL), also known as the domain layer". So that's you service layer, where you perform your business logic. The persistence layer is responsible for manipulating the database, and it is used by the service layer.
(Btw, I would prefer "service layer" instead of "domain layer" in an anemic application - that is, an application with stateless, fat services and domain objects with only getters and setters.)
Upvotes: 3