So far, you have a prototype application that uses Liferay’s Model-View-Controller (MVC) portlet framework. MVC is a great design pattern for web applications because it splits your application into three parts (the model, the view, and the controller). This lets you swap out those parts if necessary.

A persistence layer and a service layer are added to these three parts of your application. To get the prototype working, you used Portlet Properties to create a rudimentary persistence layer. Since this isn’t a long-term solution, you’ll now replace that layer by persisting your guestbooks and their entries to a database.


Figure 1: Service Builder generates the shaded layers of your application.

Service Builder is Liferay’s code generation tool for defining object models and mapping those models to SQL databases. By defining your model in a single XML file, you can generate your object model (the M in MVC), your service layer, and your persistence layer all in one shot. At the same time, you can generate web services (more on that later) and support every database Liferay Portal supports.

Ready to begin?

Let’s Go!

What is Service Builder?

Generating the Back-end Step 1 of 3 Now you’ll use Service Builder to generate create, read, update, delete, and find operations for your application. You’ll also use Service Builder to generate...

Read More

Generating Model, Service, and Persistence Layers

Generating the Back-end Step 2 of 3 The persistence layer saves and retrieves your model data. The service layer is a buffer between your application and persistence layers: having it lets you swap...

Read More

Implementing Service Methods

Generating the Back-end Step 3 of 3 When you use Service Builder, you implement the services in the service module. Because your application’s projects are components, you can reference your...

Read More
0 (0 Votes)
Displaying Guestbook Entries Previous