Creating a sample Java project for profiling
We will create a simple standalone Java application so that it is easy for you to learn how to profile using VisualVM. Although it will be a standalone application, we will create classes that are similar to those we created for the CourseManagement web application in some of the previous chapters, particularly CourseDTO, CourseBean (JSP bean), CourseService (service bean), and CourseDAO (for database access).
- Create a standard Java project in Eclipse, named
CourseManagementStandalone. Create theCourseDTOclass in thepackt.jee.eclipse.profile.dtopackage:
package packt.jee.eclipse.profile.dto;
public class CourseDTO {
private int id;
private String name;
private int credits;
//skipped Getters and Setters
} - Create the
CourseDAOclass in thepackt.jee.eclopse.profile.daopackage:
//skipped imports
public class CourseDAO {
public List<CourseDTO> getCourses() {
//No real database access takes place here
//We...