A better domain layer

Let's now revisit the domain layer created in Chapter 3, Reverse Engineering the Domain Layer with JPA. Defining an ancestor class for all entities in this layer is not only the best practice but will also make our domain layer far easier to enhance in the future. Our ancestor class is defined as follows:

package com.gieman.tttracker.domain;

import java.io.Serializable;

public abstract class AbstractEntity implements Serializable{
    
}

Although this class has an empty implementation, we will add functionality in subsequent chapters.

We will also define an appropriate interface that has one generic method to return the ID of the entity:

package com.gieman.tttracker.domain;

public interface EntityItem<T> {
    
    public T getId();
    
}

Our ...

Get Enterprise Application Development with Ext JS and Spring now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.