Putting it all together

You now have a full set of implemented getter methods. In doing the implementation, you have:

The full code for these classes is shown below:

MyNewEntityImpl

Figure 1. Complete listing for an entity implementation with implemented getter methods
package curam.mypackage;

import java.util.Set;

import com.google.inject.Inject;

import curam.mypackage.struct.MyNewEntityDtls;
import curam.util.exception.InformationalException;
import
  curam.util.persistence.helper.SingleTableLogicallyDeleteableEntityImpl;
import curam.util.type.Date;
import curam.util.type.DateRange;

/**
 * Standard implementation of {@linkplain MyNewEntity}.
 */
public class MyNewEntityImpl extends
    SingleTableLogicallyDeleteableEntityImpl<MyNewEntityDtls>
    implements MyNewEntity {

  @Inject
  private MyParentEntityDAO myParentEntityDAO;

  @Inject
  private MyChildEntityDAO myChildEntityDAO;

  protected MyNewEntityImpl() {
    /* Protected no-arg constructor for use only by Guice */
  }

  /*
   * Field getters
   */

  /**
   * {@inheritDoc}
   */
  public String getName() {
    return getDtls().name;
  }

  /**
   * {@inheritDoc}
   */
  public DateRange getDateRange() {
    return new DateRange(getDtls().startDate, getDtls().endDate);
  }

  /**
   * {@inheritDoc}
   */
  public MYNEWENTITYTYPEEntry getType() {
    return MYNEWENTITYTYPEEntry.get(getDtls().typeCode);
  }

  /*
   * Related-entity getters
   */
  /**
   * {@inheritDoc}
   */
  public Set<MyChildEntity> getMyChildren() {
    return myChildEntityDAO.searchByParent(this);
  }

  /**
   * {@inheritDoc}
   */
  public MyParentEntity getMyParentEntity() {
    final long myParentEntityID = getDtls().myParentEntityID;

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

  /*
   * Setters
   */
  public void setMyParentEntity(MyParentEntity value) {
    // TODO Auto-generated method stub

  }

  public void setName(String value) {
    // TODO Auto-generated method stub

  }

  public void setType(final MYNEWENTITYTYPEEntry value) {
    // TODO Auto-generated method stub
  }

  /*
   * Validation
   */
  public void mandatoryFieldValidation() {
    // TODO Auto-generated method stub

  }

  public void crossFieldValidation() {
    // TODO Auto-generated method stub

  }

  public void crossEntityValidation() {
    // TODO Auto-generated method stub

  }

}

MyChildEntityDAO

Figure 2. Complete listing for changes made to a related entity DAO arising from implementation of a getter which calls a new search
package curam.mypackage;

import java.util.Set;

import curam.util.persistence.StandardDAO;

/**
 * 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);

}