Interface GenericDao<ID,​E extends com.devonfw.module.basic.common.api.entity.PersistenceEntity<ID>>

    • Method Detail

      • save

        E save​(E entity)
        Saves a given entity. Use the returned instance for further operations as the save operation might have changed the entity instance completely.
        Parameters:
        entity - the entity to save
        Returns:
        the saved entity
      • save

        void save​(Iterable<? extends E> entities)
        Saves all given entities.
        Parameters:
        entities - the entities to save
      • find

        E find​(ID id)
        Retrieves an entity by its id.
        Parameters:
        id - must not be null.
        Returns:
        the entity with the given id or null if none found
        Throws:
        RuntimeException - if the requested entity does not exists (use findOne(Object) to prevent).
      • get

        E get​(com.devonfw.module.basic.common.api.reference.Ref<ID,​E> reference)
        Parameters:
        reference - the Ref to the PersistenceEntity to get. Typically an instance of IdRef.
        Returns:
        the PersistenceEntity as reference for the given Ref. Will be null if the given Ref was null.
      • exists

        boolean exists​(ID id)
        Returns whether an entity with the given id exists.
        Parameters:
        id - must not be null.
        Returns:
        true if an entity with the given id exists, false otherwise
      • findAll

        List<E> findAll​(Iterable<ID> ids)
        Returns all instances of the type with the given IDs.
        Parameters:
        ids - are the IDs of all entities to retrieve e.g. as List.
        Returns:
        an Iterable with all entites for the given ids.
      • delete

        void delete​(E entity)
        Deletes a given entity.
        Parameters:
        entity - the entity to delete
      • delete

        void delete​(Iterable<? extends E> entities)
        Deletes the given entities.
        Parameters:
        entities - the entities to delete