Book Image

Enterprise Application Development with Ext JS and Spring

By : Gerald Gierer
Book Image

Enterprise Application Development with Ext JS and Spring

By: Gerald Gierer

Overview of this book

Spring and Ext JS are cutting edge frameworks that allow us to build high performance web applications for modern devices, that are now consuming data at a faster rate than ever before. It is the appropriate time for you to understand how to best leverage these technologies when architecting, designing, and developing large scale web development projects. This practical guide condenses an approach to web development that was gained from real world projects, and outlines a simple, practical approach to developing high performance, and enterprise grade web applications. Starting with configuring Java, NetBeans, and MySQL to prepare your development environment, you will then learn how to connect your NetBeans IDE to the MySQL database server. We will then explore the Task Time Tracker (3T) project database structure and populate these tables with test data. Following on from this, we will examine core JPA concepts after reverse engineering the domain layer with NetBeans. Leveraging the Data Access Object design pattern, you will learn how to build the Java DAO implementation layer assisted by generics in base classes, followed by a Data Transfer Object enabled service layer to encapsulate the business logic of your 3T application. The final chapters that focus on Java explore how to implement the request handling layer using Spring annotated controllers, and deploy the 3T application to the GlassFish server. We will then configure the Ext JS 4 development environment and introduce key Ext JS 4 concepts, including MVC and practical design conventions. Covering a variety of important Ext JS 4 strategies and concepts, you will be fully-equipped to implement a variety of different user interfaces using the Ext JS MVC design pattern. Your journey ends by exploring the production build and deployment process using Maven, Sencha Cmd and GlassFish.
Table of Contents (22 chapters)
Enterprise Application Development with Ext JS and Spring
About the Author
About the Reviewers
Introducing Spring Data JPA

Appendix A. Introducing Spring Data JPA

The Spring Data JPA website,, has an opening paragraph that succinctly describes the problems of implementing a JPA-based DAO layer:

Implementing a data access layer of an application has been cumbersome for quite a while. Too much boilerplate code has to be written to execute simple queries as well as perform pagination, and auditing. Spring Data JPA aims to significantly improve the implementation of data access layers by reducing the effort to the amount that's actually needed. As a developer you write your repository interfaces, including custom finder methods, and Spring will provide the implementation automatically.

In Chapter 4, Data Access Made Easy, we implemented the DAO design pattern to abstract database persistence into a well-defined layer. We deliberately decided not to introduce Spring Data JPA in this chapter, as the target audience were intermediate developers who may not have had experience with the Java Persistence API. JPA terminology, concepts, and practical examples were introduced to give you an understanding of how JPA works. The use of Java interfaces, Java generics, and named query concepts are fundamental to understanding the elegant way in which Spring Data JPA works.

Spring Data JPA does not require you to write an implementation of the repository interface. The implementations are created "on the fly" when you run the Spring Data JPA application. All that the developer needs to do is write the DAO Java interfaces that extend and adhere to the Spring Data JPA naming conventions. The DAO implementation is created for you at runtime.

Internally, Spring Data JPA will implement the code that performs the same functionality that was implemented in Chapter 4, Data Access Made Easy. Using Spring Data we could, for example, rewrite the CompanyDao interface as:

package com.gieman.tttracker.dao;

import com.gieman.tttracker.domain.Company;
import java.util.List;

public interface CompanyDao extends CrudRepository<Company, Integer>{

The CompanyDao implementation will include the findAll method as it is defined in the CrudRepository interface; we do not need to define it as a separate method.

If you are comfortable with JPA and the content covered in Chapter 4, Data Access Made Easy, you should explore the Spring Data JPA framework. Implementing JPA-based repositories will then become significantly easier!