Interface GenericDAO<T,​PK extends Serializable>

  • Type Parameters:
    T - The persistent class.
    PK - The class of the primary key used to identify the objects.
    All Known Implementing Classes:
    ArchiveFileDAO, GenericHibernateDAO

    public interface GenericDAO<T,​PK extends Serializable>
    A generic class for managing storage and retrieval of persistent objects.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      PK create​(T newInstance)
      Persist the newInstance object into database.
      void delete​(T persistentObject)
      Remove an object from persistent storage in the database.
      T read​(PK id)
      Retrieve an object that was previously persisted to the database using the indicated id as primary key.
      void update​(T transientObject)
      Save changes made to a persistent object.
    • Method Detail

      • create

        PK create​(T newInstance)
        Persist the newInstance object into database.
        Parameters:
        newInstance - the object to persist.
        Returns:
        the key assigned to the object.
      • read

        T read​(PK id)
        Retrieve an object that was previously persisted to the database using the indicated id as primary key.
        Parameters:
        id - the key of the object to be retrieved.
        Returns:
        the retrieved object.
      • update

        void update​(T transientObject)
        Save changes made to a persistent object.
        Parameters:
        transientObject - the object to be updated.
      • delete

        void delete​(T persistentObject)
        Remove an object from persistent storage in the database.
        Parameters:
        persistentObject - the object to be deleted.