Service
Builder uses the spring and hibernate integration Data
Access Objects implementation mechanism in short we can call it as DAO implementation.
Conceptually for each table we have one persistence
class that will interact with table. Here actual data base interaction code will
be present.
Required things used in Liferay Service Builder-:
Here Service Builder Tool will use the spring and hibernate
technology to develop service layer to Plugin portlet.
Service Layer's -:
Persistence/DAO
classes:
Persistence or DAO classes will provide the direct data
base interaction like insert, delete and update the data in table. such kind of
logic will be present in this classes.

As we know that to interact with database we need hibernate/jdbc in java. Persistence/DAO
classes we will get the session factory object and from that we will open session,
with that session object we will do all database interactions, once we finish
all tasks we will close the session.
Model/POJO -:
The model or POJO classes will used to pass the data
from application layer to database. In the ORM/Hibernate context each row in
tables is one model or POJO object. This row we will represent as Model/POJO class.
This is simple java bean or java class has setters and getters methods.
The session always use this object to pass data to
table and same way it get the data from table and fill in pojo/model object.
At the time of database interaction we call this
object as Persistence object. The persistence object is java bean it will bind
with table’s rows when we open session to respective table.
Service
Classes -:
Service classes will be separate the application
layer and direct Data base interaction layer. Before inserting data if any
business logic is requires then we will use this service classes
After perform
the business logic then we will call DAO classes to interact with database.
We can use one service class and there we will
create many DAO objects to interact with many tables in database.
Required things used in Liferay Service Builder-:
- Data Source
- Configure All Model classes in Hibernate mapping files
- Session factory
- Configure All Service Implementation classes in spring configuration files
- Load all configuration files in spring context
Comments
Post a Comment