Defining the layers

We will create different layers in the application to process the request and take that request to the database in order to create that entry in it. 

Consider the following diagram:

We have a Controller layer that accepts the request, does the validation (if there is any validation logic there) and passes the request to the Service layer. The Service layer maps the request object to entities and passes the request to the Data Access Object (DAO) layer. The DAO layer separates the business logic from the persistence logic. It has the logic to connect to the database, thus creating this organization record in the table in our example. 

Create a simple Maven web project with Jersey, which we discussed earlier, and other JPA dependencies that we described in Chapter 5, Kotlin with JPA and EJB.

Add different packages, such as controller, service, dao, and so on. Take a look at the following screenshot:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset