Business Objects of Business Logic tier

In this section we will develop the objects of business logic tier.

Business Objects of Business Logic tier

Business Objects of Business Logic tier

        

In this section we will develop the objects of business logic tier. Business logic tier referrers to the mid tier of 3-tier web application architecture.

Business Objects

Business logic tier communicates both with user interface tier and the database tier. In the business logic tier all the logic are encapsulated. The business objects and business services in the application resides in the Business logic tier. The business objects contains the data and logic associated with the data. In our application application there is only one business object the User.

Here is the code of User.java business object:

package net.roseindia.dao.hibernate;

import java.io.Serializable;

/** @author Hibernate CodeGenerator */
public class User implements Serializable {

  /** identifier field */
  private Integer userId;

  /** nullable persistent field */
  private String userName;

  /** nullable persistent field */
  private String userPassword;


  /** nullable persistent field */
  private String userEmail;

  /** nullable persistent field */
  private String userAddress;

  /** full constructor */
  public User(Integer userId, String userName, 
   String userPassword, String userEmail,String userAddress
) {
  this.userId = userId;
  this.userName = userName;
  this.userPassword = userPassword;
  this.userEmail = userEmail;
  this.userAddress = userAddress;
  }

  /** default constructor */
  public User() {
  }

  /** minimal constructor */
  public User(Integer userId) {
  this.userId = userId;
  }

  public Integer getUserId() {
  return this.userId;
  }

  public void setUserId(Integer userId) {
  this.userId = userId;
  }

  public String getUserName() {
  return this.userName;
  }

  public void setUserName(String userName) {
  this.userName = userName;
  }

  public String getUserPassword() {
  return this.userPassword;
  }

  public void setUserPassword(String userPassword) {
  this.userPassword = userPassword;
  }



  public String getUserEmail() {
  return this.userEmail;
  }

  public void setUserEmail(String userEmail) {
  this.userEmail = userEmail;
  }

  public String getUserAddress() {
  return this.userAddress;
  }

  public void setUserAddress(String userAddress) {
  this.userAddress = userAddress;
  }

}

Since we are using Hibernate for persistence, the User business object provides getter and setter methods for all fields.

Business Services

Business Services contains the code to interact with the data tier. In this application we have developed a formal service layer, client can use these services interface. There is only one service in this application the ServiceFinder. The ServiceFinder service is used to get the Spring managed beans from WebApplicationContext.

In the next section we will learn about Integration tier of our application. Integration tier is also known as data access tier.