Interface EntityFinder

All Known Implementing Classes:
MockEntityFinder, SpringDataEntityFinder

public interface EntityFinder
Provides a generic interface for custom entity finders. The entity finder is used within MergedFormMethodArgumentResolver to fetch the entity.
Author:
Robert Bor
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    find(Long id, Class<T> entityClass)
    Returns the entity on the basis of the entity class and its ID.
    <T> T
    findAndDetach(Long id, Class<T> entityClass)
    Returns the entity on the basis of the entity class and its ID bypassing the Hibernate cache
  • Method Details

    • find

      <T> T find(Long id, Class<T> entityClass) throws javax.persistence.EntityNotFoundException
      Returns the entity on the basis of the entity class and its ID.
      Parameters:
      entityClass - the class of the entity
      id - the ID of the entity
      Returns:
      the entity if found
      Throws:
      javax.persistence.EntityNotFoundException - if the repository or the entity could not be found
    • findAndDetach

      <T> T findAndDetach(Long id, Class<T> entityClass) throws javax.persistence.EntityNotFoundException
      Returns the entity on the basis of the entity class and its ID bypassing the Hibernate cache
      Parameters:
      entityClass - the class of the entity
      id - the ID of the entity
      Returns:
      the entity if found
      Throws:
      javax.persistence.EntityNotFoundException - if the repository or the entity could not be found