com.ibm.commerce.foundation.persistence

Interface EntityDao<E,Id>

  • Type Parameters:
    E - The entity class.
    Id - The entity ID class.


    public interface EntityDao<E,Id>
    A generic interface for data access objects that work with a single entity class. Recommend to extend AbstractJPAEntityDaoImpl rather than implement this interface directly.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      java.lang.Long count(java.lang.String queryAlias, java.lang.Object... queryArguments)
      Returns the result count.
      E find(Id entityId)
      Finds an entity by its ID.
      java.lang.Long generatePrimaryKey(java.lang.String table)
      Returns the generated primary key for a table.
      E merge(E entityUpdate)
      Merges (creates or updates) an entity.
      void persist(E entity)
      Persists (creates) an entity.
      java.util.List<E> query(java.lang.String queryAlias, java.lang.Object... queryArguments)
      Returns the results of a query with page start and size.
      org.apache.commons.lang3.tuple.Pair<java.util.List<E>,java.lang.Long> queryAndCount(java.lang.String queryAlias, java.lang.Object... queryArguments)
      Returns the results of a query and the result count.
      java.util.List<E> queryWithOffSet(java.lang.String queryAlias, java.lang.Object... queryArguments)
      Returns the results of a query.
      void remove(E entity)
      Removes (deletes) an entity.
      void setFields(java.lang.String fields)
      Sets the fields to return.
      void setLimit(java.lang.Integer limit)
      Sets the maximum number of items to return.
      void setMeta(java.lang.Boolean meta)
      Sets whether to return meta data.
      void setOffset(java.lang.Integer offset)
      Sets the offset of the first entity to return.
      void setPageSize(java.lang.Integer pageSize)
      Sets the page size to return.
      void setPageStart(java.lang.Integer pageStart)
      Sets the page start to return.
      void setParameterMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> parameterMap)
      Sets the parameters.
      void setSort(java.lang.String sort)
      Sets the sorting rule.
    • Field Detail

      • COPYRIGHT

        static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Method Detail

      • setSort

        void setSort(java.lang.String sort)
        Sets the sorting rule.
        Parameters:
        sort - The sorting rule.
      • setOffset

        void setOffset(java.lang.Integer offset)
        Sets the offset of the first entity to return.
        Parameters:
        offset - The offset of the first entity to return.
      • setLimit

        void setLimit(java.lang.Integer limit)
        Sets the maximum number of items to return.
        Parameters:
        limit - The maximum number of items to return.
      • setPageStart

        void setPageStart(java.lang.Integer pageStart)
        Sets the page start to return.
        Parameters:
        page - start The page start to return.
      • setPageSize

        void setPageSize(java.lang.Integer pageSize)
        Sets the page size to return.
        Parameters:
        page - size The page size to return.
      • setFields

        void setFields(java.lang.String fields)
        Sets the fields to return.
        Parameters:
        fields - The fields to return.
      • setMeta

        void setMeta(java.lang.Boolean meta)
        Sets whether to return meta data.
        Parameters:
        meta - Whether to return meta data.
      • setParameterMap

        void setParameterMap(java.util.Map<java.lang.String,java.util.List<java.lang.String>> parameterMap)
        Sets the parameters.
        Parameters:
        parameterMap - The parameters.
      • find

        E find(Id entityId)
        Finds an entity by its ID.
        Parameters:
        entityId - The entity ID.
        Returns:
        The entity.
      • queryWithOffSet

        java.util.List<E> queryWithOffSet(java.lang.String queryAlias,
                                          java.lang.Object... queryArguments)
        Returns the results of a query.
        Parameters:
        queryAlias - The query alias. Can be null.
        queryArguments - The query arguments.
        Returns:
        The results.
      • query

        java.util.List<E> query(java.lang.String queryAlias,
                                java.lang.Object... queryArguments)
        Returns the results of a query with page start and size.
        Parameters:
        queryAlias - The query alias. Can be null.
        queryArguments - The query arguments.
        Returns:
        The results.
      • count

        java.lang.Long count(java.lang.String queryAlias,
                             java.lang.Object... queryArguments)
        Returns the result count.
        Parameters:
        queryAlias - The query alias. Can be null.
        queryArguments - The query arguments.
        Returns:
        The result count.
      • queryAndCount

        org.apache.commons.lang3.tuple.Pair<java.util.List<E>,java.lang.Long> queryAndCount(java.lang.String queryAlias,
                                                                                            java.lang.Object... queryArguments)
        Returns the results of a query and the result count.
        Parameters:
        queryAlias - The query alias. Can be null.
        queryArguments - The query arguments.
        Returns:
        The results and the result count.
      • persist

        void persist(E entity)
        Persists (creates) an entity.
        Parameters:
        entity - The entity.
      • merge

        E merge(E entityUpdate)
        Merges (creates or updates) an entity.
        Parameters:
        entityUpdate - Update to the entity.
        Returns:
        The entity.
      • remove

        void remove(E entity)
        Removes (deletes) an entity.
        Parameters:
        entity - The entity.
      • generatePrimaryKey

        java.lang.Long generatePrimaryKey(java.lang.String table)
        Returns the generated primary key for a table.
        Parameters:
        table - The table name.
        Returns:
        The generated primary key.