Skip to main content

Basic Concept of Service Builder

What is Service Builder ?

Service Builder is a model-driven code generation tool built by Liferay that allows developers to define custom object models called entities.

Service Builder generates a service layer through object-relational mapping (ORM) technology that provides a clean separation between your object model and code for the underlying database.

Service Builder add the necessary business logic for your application.

Service Builder takes an XML file as input and generates the necessary model, persistence, and service layers for your application.
application-layers.png
Service layer is set of java classes and interfaces which implement the database interaction logic.

Service Builder uses the spring and hibernate integration Data Access Objects implementation mechanism in short we can call it as DAO implementation.

Service Builder Tool will use the spring and hibernate technology to develop service layer to Plugin portlet.

Important operation that Service Builder perform ?

  • Automatically generated model, persistence, and service layers
  • Automatically generated local and remote services
  • Automatically generated Hibernate and Spring configurations
  • Support for generating finder methods for entities and finder methods that account for permissions
  • Built-in entity caching support
  • Support for custom SQL queries and dynamic queries
  • Saved development time

How Service Builder Works ?

To generate a basic service layer, you only need to create a service.xml file and run Service Builder. This generates a new service .jar file for your project. The generated service .jar file includes a model layer, a persistence layer, a service layer, and related infrastructure.

Service Builder reads a single file called service.xml that’s used for defining entities. Once you create the file, you can then define your entities.

  • To define a custom entity, follow these steps:  
  1. Create the service.xml file in your project’s docroot/WEB-INF folder, if one does not already exist there.
  2. Define global information for the service.
  3. Define service entities.
  4. Define the columns (attributes) for each service entity.
  5. Define relationships between entities.
  6. Define a default order for the entity instances to be retrieved from the database.
  7. Define finder methods that retrieve objects from the database based on specified parameters.
  8. Let’s examine these steps in detail, starting with creating a service.xml file.
      


Comments

Popular posts from this blog

Liferay 7.1 Topics Coming Soon stay connected

1. Liferay 7.1 Service Builder 2. Rest Service and Liferay 3. Consuming SOAP service with Liferay 7.1 4. Creating Theme With Liferay 7.1 Using Liferay IDE Using NPM 5. Create Angular NPM Module 6. Web Content Management 7. OSGI Basic 8. Liferay 7.1 with more than 1 DB 9. A sample project 10. Liferay Dev Ops

How the portal page is loaded with respective portlets

How the portal page is loaded with respective portlets When a user requests a page with a URL, 1.    The browser sends the request to the Application Server (AS). 2.    Liferay gets the page name from the URL. 3.    It goes to the layout database table and finds the related        theme and page layout. 4.    Based on the page layout, Liferay finds the portlets added        into each area of the page layout. 5.    Liferay runs the portlet and adds the output in the        portlet.vm template. 6.    Liferay interprets the portlet.vm template and adds the output        in the page layout. 7.    Then Liferay interprets the page layout and adds the output in        the portal_normal.vm template. 8.    After that Liferay interprets the portal...

Service Builder 1

Service Builder uses the spring and hibernate integration Data Access Objects implementation mechanism in short we can call it as DAO implementation. 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. Conceptually for each table we have one persistence class that will interact with table. Here actual data base interaction code will be present. 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 wi...