The solution

You must create implementations for your skeletal getter methods created above. Each getter method is responsible for retrieving one or more fields from an underlying Dtls struct and returning a value (either primitive or object) to calling code.

The implementation of your entity has at its heart an instance of a RowManager. The RowManager instance contains a generated Dtls struct and manages the manipulation of this struct.

Getter methods must use the RowManager. getDtls method to get at the Dtls struct. For implementations extending SingleTableEntityImpl (which the example does via SingleTableLogicallyDeleteableEntityImpl), there is a convenience getDtls method which can be used directly as a shorthand.

Our example requires these getters to be implemented:

In general the JavaDoc for your getter implementations can simply inherit from your entity API JavaDoc.

getName

The getter for name is a straight-forward mapping of the name held in the Dlts struct:

Figure 1. Implementation of a simple get method
/**
   * {@inheritDoc}
   */
  public String getName() {
    return getDtls().name;
  }

getDateRange

The getter for your entity's date range must use the startDate and endDate held on the generated Dtls struct and construct a new DateRange object:

Figure 2. Implementation of a get method which returns a single object representing multiple database column values
/**
   * {@inheritDoc}
   */
  public DateRange getDateRange() {
    return new DateRange(getDtls().startDate, getDtls().endDate);
  }

getType

The getter for your entity's type must retrieve the relevant MYNEWENTITYTYPEEntry value based on the codetable code String value held in the typeCode field on the Dtls struct:

Figure 3. Implementation of a get method which returns a codetable entry value
/**
   * {@inheritDoc}
   */
   public MYNEWENTITYTYPEEntry getType() {
     return MYNEWENTITYTYPEEntry.get(getDtls().typeCode);
   }

getMyParentEntity

The getter for a single record must retrieve that related record and return it. However, the getter must check whether the key is currently zero (which is used throughout the server application to signify that a unique ID value has not been set), and if so instead return null.

Create a class member variable for the related record's DAO:

Figure 4. Creating a member variable for a related entity's DAO
@Inject
  private MyParentEntityDAO myParentEntityDAO;

In the getter, conditionally call the DAO, depending on whether the value of myParentEntityID is zero:

Figure 5. Implementing a get method to retrieve a related entity instance
/**
   * {@inheritDoc}
   */
  public MyParentEntity getMyParentEntity() {
    final long myParentEntityID = getDtls().myParentEntityID;

    if (myParentEntityID == 0) {
      return null;
    } else {
      return myParentEntityDAO.get(myParentEntityID);
    }
  }

getMyChildren

The getter for a set of related records must call a DAO method to perform a search.

Create a class member variable for the related records' DAO:

Figure 6. Creating a member variable for another related entity's DAO
@Inject
  private MyChildEntityDAO myChildEntityDAO;

In the getter, call the DAO passing in this object:

Figure 7. Implementing a get method to retrieve a set of related entity instances
/**
   * {@inheritDoc}
   */
  public Set<MyChildEntity> getMyChildren() {
    return myChildEntityDAO.searchByParent(this);
  }

You must add the searchByParent method to the DAO:

Figure 8. Adding a search method to the related entity's DAO interface
/**
 * Data access for {@linkplain MyChildEntity}.
 */
public interface MyChildEntityDAO
  extends StandardDAO<MyChildEntity> {

  /**
   * Searches all the instances belonging to the specified parent.
   *
   * @param myNewEntity
   *          the parent to search for
   * @return all the instances belonging to the specified parent, or
   *         an empty set if none found.
   */
  public Set<MyChildEntity> searchByParent(
    final MyNewEntity myNewEntity);
Important: Do not be tempted to take Eclipse's suggestion of using the MyNewEntityImpl class as an argument:
Figure 9. Incorrect - adding a search method taking the entity implementation as a parameter
/** ********** VERY VERY BAD - DO NOT DO THIS! ********** */
  /**
   * Searches all the instances belonging to the specified parent.
   *
   * @param impl
   *          the parent to search for
   * @return all the instances belonging to the specified parent, or
   *         an empty set if none found.
   */
  public Set<MyChildEntity> searchByParent(MyNewEntityImpl impl);
  /** ********** VERY VERY BAD - DO NOT DO THIS! ********** */

(The underlying principle here is that entity and DAO interfaces are allowed to be dependent on other entity and DAO interfaces, but are not allowed to be dependent on implementations.)

If an implementation exists for MyChildEntityDAO, then you must implement the new method, and model a new search operation (a readmulti) to retrieve the required records.