Interface IGenericDao<E extends de.xima.cmn.dao.interfaces.IEntity<Long>>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default int count​(IEntityContext ec, de.xima.cmn.criteria.FilterCriterion filter)
      Convenience method for resultTotalCount(ec, qcm) for the very common case where you only need to specify a filter.
      default List<E> findAll​(IEntityContext ec, de.xima.cmn.criteria.FilterCriterion filter)
      Convenience method for all(ec, qcm) for the very common case where you only need to specify a filter.
      default E findSingle​(IEntityContext ec, de.xima.cmn.criteria.FilterCriterion filter)
      Convenience method for singleElement(ec, qcm) for the very common case where you only need to specify a filter.
      Set<de.xima.cmn.dao.interfaces.IEntity<Long>> getEntityRefs​(IEntityContext ec, E entity)
      Returns a set of entities that reference the given entity and depend on it.
      E read​(IEntityContext ec, Integer id)  
      • Methods inherited from interface de.xima.cmn.dao.interfaces.IAbstractDao

        all, bulkDelete, bulkUpdate, checkLockingVersion, create, create, delete, delete, deleteAll, executePagedDaoAction, getAttributes, getAttributes, getSingleAttributes, getSingleAttributes, getTransactionHandler, read, registerListener, registerListener, registerListener, resultTotalCount, setTransactionHandler, singleElement, unregisterListener, unregisterListener, unregisterListener, update, update
    • Method Detail

      • read

        E read​(IEntityContext ec,
               Integer id)
        throws de.xima.cmn.dao.exceptions.ReadException
        Throws:
        de.xima.cmn.dao.exceptions.ReadException
      • getEntityRefs

        Set<de.xima.cmn.dao.interfaces.IEntity<Long>> getEntityRefs​(IEntityContext ec,
                                                                    E entity)
        Returns a set of entities that reference the given entity and depend on it. An entity can usually not be deleted if it is still being referenced by and depended on by other entities.
        Parameters:
        ec - entity context for database transactions.
        entity - to get references for.
        Returns:
        a set of entities that reference the given entity and depend on it.
      • count

        default int count​(IEntityContext ec,
                          de.xima.cmn.criteria.FilterCriterion filter)
        Convenience method for resultTotalCount(ec, qcm) for the very common case where you only need to specify a filter. Especially useful in combination with FilterCriterionBuilder.
         dao.count(ec, and(eq("name", "foo"), greaterOrEqual("value", 9));
         
        Parameters:
        ec - Entity context to use for accessing the database.
        filter - Filter for the entities to match. For combining multiple filters, you can use and as well as or.
        Returns:
        The number of entities matching the given filter.
        Throws:
        de.xima.cmn.dao.exceptions.ReadException - When the database could not be accessed.
      • findAll

        default List<E> findAll​(IEntityContext ec,
                                de.xima.cmn.criteria.FilterCriterion filter)
        Convenience method for all(ec, qcm) for the very common case where you only need to specify a filter. Especially useful in combination with FilterCriterionBuilder.
         dao.allBy(ec, and(eq("name", "foo"), greaterOrEqual("value", 9));
         
        Parameters:
        ec - Entity context to use for accessing the database.
        filter - Filter for the entities to return. For combining multiple filters, you can use and as well as or.
        Returns:
        All entities matching the given filter.
        Throws:
        de.xima.cmn.dao.exceptions.ReadException - When the database could not be accessed.
      • findSingle

        default E findSingle​(IEntityContext ec,
                             de.xima.cmn.criteria.FilterCriterion filter)
        Convenience method for singleElement(ec, qcm) for the very common case where you only need to specify a filter. Especially useful in combination with FilterCriterionBuilder. For example:
         var attachment = ATTACHMENT_DAO.findSingle(ec, and(
             eq(Attachment.ATTR_VORGANG, IFormRequestContext requestCtx.getVorgang()),
             eq(Attachment.ATTR_SOURCE, EAttachmentSource.FORM_UPLOAD),
             eq(Attachment.ATTR_ELEMENT_NAME, "upl1")
         ));
         
        Parameters:
        ec - Entity context to use for accessing the database.
        filter - Filter for the entities to return. For combining multiple filters, you can use and as well as or.
        Returns:
        All entities matching the given filter.
        Throws:
        de.xima.cmn.dao.exceptions.ReadException - When the database could not be accessed.